Main Content

dvbs2xBitRecover

Recover bits for DVB-S2X PL frames

    Description

    example

    bits = dvbs2xBitRecover(rxdata,nvar) recovers user packets (UPs) or a continuous bit stream, bits. Input rxdata is the received complex in-phase quadrature (IQ) symbols in the form of physical layer (PL) frames of a Digital Video Broadcasting Satellite Second Generation extended (DVB-S2X) single or multi-input stream transmission. Input nvar is the noise variance estimate, which the function uses to calculate soft bits.

    example

    [bits,numFramesLost,pktCRCStatus,decodedParams] = dvbs2xBitRecover(rxdata,nvar) also returns the number of frames lost numFramesLost UP cyclic redundancy check (CRC) status pktCRCStatus and a structure decodedParams in which the fields indicate the parameters of the processed PL frames.

    example

    [___] = dvbs2xBitRecover(rxdata,nvar,Name=Value) specifies one or more optional name-value arguments. For example, Mode="wideband" sets the mode of operation for the bit recovery to the wideband frame processing mode.

    Examples

    collapse all

    Recover UPs for a given PL frame in a single transport stream (TS) DVB-S2X transmission in regular mode.

    This example uses MAT files with LDPC parity matrices. If the MAT files are not available on the path, download and unzip the MAT files by entering this code at the MATLAB command line.

    if ~exist("dvbs2xLDPCParityMatrices.mat","file")
        if ~exist("s2xLDPCParityMatrices.zip","file")
            url = "https://ssd.mathworks.com/supportfiles/spc/satcom/DVB/s2xLDPCParityMatrices.zip";
            websave("s2xLDPCParityMatrices.zip",url);
            unzip("s2xLDPCParityMatrices.zip");
        end
    addpath("s2xLDPCParityMatrices");
    end

    Specify the number of PL frames per stream and set the baseband filtering at 4 samples per symbol.

    nFrames = 1;
    s2xWaveGen = dvbs2xWaveformGenerator;
    sps = 4;

    Create a bit vector of information bits, data, of concatenated TS UPs.

    syncBits = [0 1 0 0 0 1 1 1]';                   % Sync byte for TS packet is 47 Hex
    pktLen = 1496;                                   % UP length without sync bits is 1496
    numPkts = s2xWaveGen.MinNumPackets*nFrames;
    txRawPkts = randi([0 1],pktLen,numPkts);
    txPkts = [repmat(syncBits,1,numPkts); txRawPkts];
    data = txPkts(:);

    Generate the DVB-S2X time-domain waveform using the input information bits. Flush the transmit filter to handle the filter delay and recover the complete last frame.

    txWaveform = [s2xWaveGen(data); flushFilter(s2xWaveGen)];

    Add additive white Gaussian noise (AWGN) to the generated waveform.

    EsNodB = 5;
    snrdB = EsNodB - 10*log10(sps);
    rxWaveform = awgn(txWaveform,snrdB,"measured");

    Create a raised cosine receiver filter.

    rxFilter = comm.RaisedCosineReceiveFilter( ...
           "RolloffFactor",s2xWaveGen.RolloffFactor, ...
           "InputSamplesPerSymbol",sps,"DecimationFactor",sps);

    Apply matched filtering and remove the filter delay.

    filtOut = rxFilter(rxWaveform);
    rxSymb = filtOut(rxFilter.FilterSpanInSymbols+1:end);

    Recover UPs.

    [rxOut,numFramesLost] = dvbs2xBitRecover(rxSymb,10^(-EsNodB/10));  

    Display the number of frames lost and the UP cyclic redundancy check (CRC) status.

    fprintf("numFramesLost = %d\n",numFramesLost)
    numFramesLost = 0
    
    fprintf("Number of bit errors = %d\n",sum(data~=rxOut{1}))
    Number of bit errors = 0
    

    Recover user bits in a multi-input generic stream (GS) DVB-S2X transmission, with variable modulation and coding scheme, in wideband mode.

    This example uses MAT files with LDPC parity matrices. If the MAT files are not available on the path, download and unzip the MAT files by entering this code at the MATLAB command prompt.

    if ~exist("dvbs2xLDPCParityMatrices.mat","file")
        if ~exist("s2xLDPCParityMatrices.zip","file")
            url = "https://ssd.mathworks.com/supportfiles/spc/satcom/DVB/s2xLDPCParityMatrices.zip";
            websave("s2xLDPCParityMatrices.zip",url);
            unzip("s2xLDPCParityMatrices.zip");
        end
        addpath("s2xLDPCParityMatrices");
    end

    Specify the number of PL frames per stream and set the baseband filtering at 4 samples per symbol.

    nFramesPerStream = 2;
    sps = 4;

    Create a DVB-S2X System object™ with variable coding and modulation configuration for a multi-input GS and set its properties.

    s2xWaveGen = dvbs2xWaveformGenerator;
    s2xWaveGen.NumInputStreams = 5;
    s2xWaveGen.PLSDecimalCode = [140 132 133 141 132];
    s2xWaveGen.DFL = [37168 18448 18448 37168 18448];
    s2xWaveGen.StreamFormat = "GS";
    s2xWaveGen.HasTimeSlicing = true;

    Create a bit vector of input information bits for each input stream.

    data = cell(s2xWaveGen.NumInputStreams,1);
    for i = 1:s2xWaveGen.NumInputStreams
      data{i} = randi([0 1],s2xWaveGen.DFL(i)*nFramesPerStream,1);
    end

    Generate the DVB-S2X time-domain waveform using the input information bits. Flush the transmit filter to handle the filter delay and recover the complete last frame.

    txWaveform = [s2xWaveGen(data); flushFilter(s2xWaveGen)];

    Add additive white Gaussian noise (AWGN) to the generated waveform.

    EsNodB = 4;
    snrdB = EsNodB - 10*log10(sps);
    rxWaveform = awgn(txWaveform,snrdB,"measured");

    Create a raised cosine receiver filter.

    rxFilter = comm.RaisedCosineReceiveFilter( ...
        "RolloffFactor",s2xWaveGen.RolloffFactor, ...
        "InputSamplesPerSymbol",sps,"DecimationFactor",sps);

    Apply matched filtering and remove the filter delay.

    filtOut = rxFilter(rxWaveform);
    rxSymb = filtOut(rxFilter.FilterSpanInSymbols+1:end);

    Set the time slicing number to the required PL frame value to be recovered. Recover the user bits.

    tsn = 3;
    [rxOut,numFramesLost,pktCRCStat] = dvbs2xBitRecover(rxSymb,10^(-EsNodB/10), ...
                                                         Mode="wideband", ...
                                                         TimeSlicingNumber=tsn);

    Display the number of frames lost and the UP CRC status.

    fprintf("numFramesLost = %d\n",numFramesLost)
    numFramesLost = 0
    
    fprintf("Number of bit errors = %d\n",sum(data{tsn}~=rxOut{1}))
    Number of bit errors = 0
    

    Recover UPs for a given PL frame in a single TS DVB-S2X transmission in VL-SNR mode.

    This example uses MAT files with LDPC parity matrices. If the MAT files are not available on the path, download and unzip the MAT files by entering this code at the MATLAB command prompt.

    if ~exist("dvbs2xLDPCParityMatrices.mat","file")
        if ~exist("s2xLDPCParityMatrices.zip","file")
            url = "https://ssd.mathworks.com/supportfiles/spc/satcom/DVB/s2xLDPCParityMatrices.zip";
            websave("s2xLDPCParityMatrices.zip",url);
            unzip("s2xLDPCParityMatrices.zip");
        end
        addpath("s2xLDPCParityMatrices");
    end

    Specify the number of PL frames per stream and set the baseband filtering at 4 samples per symbol.

    nFrames = 1;
    sps = 4;

    Create a DVB-S2X System object™ for TS and set its properties.

    s2xWaveGen = dvbs2xWaveformGenerator;
    s2xWaveGen.PLSDecimalCode = 129;
    s2xWaveGen.NumInputStreams = 1;
    s2xWaveGen.DFL = 14128;
    s2xWaveGen.PLScramblingIndex =4;

    Create a bit vector of information bits, data, of concatenated TS UPs.

    syncBits = [0 1 0 0 0 1 1 1]';                   % Sync byte for TS packet is 47 Hex
    pktLen = 1496;                                   % UP length without sync bits is 1496
    numPkts = s2xWaveGen.MinNumPackets*nFrames;
    txRawPkts = randi([0 1],pktLen,numPkts);
    txPkts = [repmat(syncBits,1,numPkts); txRawPkts];
    data = txPkts(:);

    Generate the DVB-S2X time-domain waveform using the input information bits. Flush the transmit filter to handle the filter delay and recover the complete last frame.

    txWaveform = [s2xWaveGen(data); flushFilter(s2xWaveGen)];

    Add additive white Gaussian noise (AWGN) to the generated waveform.

    EsNodB = -2;
    snrdB = EsNodB - 10*log10(sps);
    rxWaveform = awgn(txWaveform,snrdB,"measured");

    Create a raised cosine receiver filter.

    rxFilter = comm.RaisedCosineReceiveFilter( ...
        "RolloffFactor",s2xWaveGen.RolloffFactor, ...
        "InputSamplesPerSymbol",sps,"DecimationFactor",sps);

    Apply matched filtering and remove the filter delay.

    filtOut = rxFilter(rxWaveform);
    rxSymb = filtOut(rxFilter.FilterSpanInSymbols+1:end);

    Recover UPs.

    [rxOut,numFramesLost,pktCRCStat,decodedParams] = dvbs2xBitRecover(rxSymb,10^(-EsNodB/10), ...
                                     Mode="vl-snr",PLScramblingIndex=4);

    Display the number of frames lost and parameters of the processed PL frame.

    fprintf("numFramesLost = %d\n",numFramesLost)
    numFramesLost = 0
    
    disp(decodedParams)
             PLSDecimalCode: 129
               IsDummyFrame: 0
             BBHeaderStatus: 1
            ModulationOrder: 4
             FECFrameLength: 64800
        CanonicalMODCODName: {'QPSK 2/9'}
                  HasPilots: 1
    

    Input Arguments

    collapse all

    Received IQ symbols from the PL frames of a DVB-S2X single-input or multi-input transmission, specified as a column vector. rxdata can contain one or more PL frames.

    The length of rxdata depends on the forward error correction (FEC) frame length, modulation order, mode (regular, VL-SNR, or wideband), and presence or absence of pilots specified for the PL frame.

    Data Types: double
    Complex Number Support: Yes

    Noise variance estimate that the function adds to the input IQ symbols, specified as a nonnegative scalar. The function uses nvar as a scaling factor to calculate the soft bits from the IQ symbols.

    When you specify nvar as 0, the function uses a value of 1e–5, which corresponds to a signal-to-noise ratio (SNR) of 50 dB.

    Data Types: double

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

    Example: Mode="wideband" sets the mode of operation for the bit recovery to wideband frame processing mode.

    PL scrambling sequence index, specified as a integer in the range [0, 7] or as a vector of integers in the range [0, 7].

    The function uses a gold sequence index of PLScramblingIndex*10949, as defined in ETSI EN 302 307-2 section 5.5.4 table 19e [1].

    When you specify Mode as "wideband", the PLScramblingIndex value must be equal to the scrambling sequence index value of the sequence used to scramble the required wideband PL frames.

    Data Types: double

    Flag for early termination of the LDPC decoder when all parity-checks are satisfied, specified as a numeric or logical value of 1 (true) or 0 (false). When set to 1, the LDPC decoder is terminated when all parity checks are satisfied.

    When you set this value to 0, the maximum decoding iteration limit is 50.

    If the modulation order of the PL frame is 2, the maximum decoding iteration limit is 75.

    Data Types: logical

    Mode of operation for the bit recovery, specified as one of these values.

    • "regular — Use this option to set the mode to regular frame processing.

    • "vl-snr" — Use this option to set the mode to very low signal-to-noise ratio (VL-SNR) frame processing.

    • "wideband" — Use this option to set the mode to wideband frame processing.

    Note

    For this function, wideband mode does not support VL-SNR frame processing.

    Data Types: char | string

    Time slicing number encoded into the PL header of the required wideband frames, specified as a scalar in the range [0, 253].

    If the time slicing number decoded from a PL header is not equal to the required time slicing number value, the function discards the PL frame and decodes the next wideband frame PL header.

    To use this argument, you must specify Mode as "wideband".

    Note

    In wideband mode, the number of streams is considered as number of services, where each stream is considered to be an individual service. The receiver recovers only the service specified by the TimeSlicingNumber argument.

    Data Types: double

    Output Arguments

    collapse all

    Recovered data bits, returned as a cell array of column vectors. Each element of the cell array is of data type int8. This output can be either UPs or a generic data stream, depending of the StreamFormat property of the dvbs2xWaveformGenerator System object.

    For a multi-input stream transmission, each element of the cell array corresponds to an individual input stream.

    Data Types: cell

    Number of lost baseband frames, returned as a nonnegative integer. If the baseband header CRC fails, the function considers the frame as lost.

    Data Types: double

    UP CRC status, returned as a cell array of column vectors. Each element of the cell array is of data type logical. For a multi-input stream transmission, each element of the cell array corresponds to an individual input stream.

    pktCRCStatus applies for only the input streams where the value of the UPL property of dvbs2xWaveformGenerator System object is nonzero. When UPL is set to zero, pktCRCStatus returns an empty output.

    Data Types: cell

    Parameters of the processed PL frames, returned as a structure with these fields.

    Structure FieldValueDescription
    PLSDecimalCode0 or integer in the range [4, 249]

    PL signaling code information derived from the PL header recovery.

    IsDummyFrame0 (false) or 1 (true)

    Flag to indicate whether the decoded PL frame is a dummy frame. A value of 1 (true) indicates the decoded PL frame is a dummy frame.

    BBHeaderCRCStatus0 (false) or 1 (true)

    Flag to indicate whether the baseband (BB) header CRC check passed. A value of 1 (true) indicates the header CRC is valid.

    This field is returned as 0 (false) for dummy frames.

    ModulationOrderInteger from the set {0, 2, 4, 8, 16, 32, 64, 128, 256}

    Modulation order of the FEC frame symbols.

    This field is returned as 0 for dummy frames.

    FECFrameLength16200, 32400, or 64800

    FEC frame length is the output length (in bits) specified to the FEC encoder.

    This field is returned as 0 for dummy frames.

    CanonicalMODCODNamecell array

    Canonical modulation scheme and code rate name for VL-SNR frame transmissions. This field is present only if you pass a VL-SNR frame to this ideal receiver.

    Valid CanonicalMODCODName values include these options.

    • "QPSK 2/9", "BPSK 1/5", "BPSK 11/45", "BPSK-S 1/5", "BPSK-S 11/45", and "BPSK 1/3" — Applicable for VL-SNR set 1

    • "BPSK 1/5", "BPSK 4/15", "BPSK 1/3", and "dummy" — Applicable for VL-SNR set 2

    If the frame passed to the receiver is not a VL-SNR frame, the output of this field is an empty string.

    HasPilots0 (false) or 1 (true)

    Flag to indicate the pilot block. A value of 1 (true) indicates the presence of pilots.

    This field is returned as 0 (false) for dummy frames.

    In the case of a single-input stream, all structure fields except CanonicalMODCODName are returned as integers and as vectors in the case of a multi-input stream. For a multi-input stream, each element of a vector corresponds to an individual input stream.

    Whether for a single-input stream or a multi-input stream, the function returns CanonicalMODCODName as a cell array, where each element of the cell array is of data type char or string.

    Data Types: struct

    References

    [1] ETSI Standard EN 302 307-2 V1.1.1(2015-11). Digital Video Broadcasting (DVB); Second Generation Framing Structure, Channel Coding and Modulation Systems for Broadcasting, Interactive Services, News Gathering and Other Broadband Satellite Applications; Part 2: DVB-S2 Extensions (DVB-S2X)

    Extended Capabilities

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

    Version History

    Introduced in R2022b