CCSDS standard LDPC Code simulation

Source: Internet
Author: User

the document was published in MATLAB and the simulation did not run out.
CCSDS standard LDPC Code simulation

This script completes the simulation of the process of LDPC coding for Deep Space communication task in the CCSDS Standard (O1) version, and gives the result of bit error rate simulation when the information bit length is 1024 and the bitrate is 1/2.

  Written by: Cao Wenhui  Last modified: 2015-03-07  software version: MATLAB (R) 2014a

Compared to previous versions (LDPC_SIMULATION.M), this program adds features including

    1. Complete the validation matrix construction (CCSDSCHECKMATRIX.M)
    2. Construct matrices (quasi-loops) by validating matrix (CCSDSGENERATEMATRIX.M)
    3. According to CCSDS, intercept the encoded data and complete the simulation of LDPC code conforming to the CCSDS document.

Program modifications include

    1. None of the decoding functions in the previous folder can properly handle all 0 items
    2. The problem will be corrected appropriately, while optimizing the output display
Contents
    • Initial setup
    • BER Simulation
    • Simulation results
Initial setup

Empty workspace, data, close all windows

 All All;

Simulation parameter settings

ebn0_db = 1;% ebn0_db ber range, vector;Frames_num = 1;% frames_num Maximum number of emulated frames;Max_iter_num = 30;% Max_iter_num algorithm maximum number of iterations;Max_error_frame = 200;% Max_error_frame Simulation Maximum number of error frames;Biterror = Zeros (1,length (ebn0_db));% biterror Error number statistics, vectors;BER = Biterror;% ber ber, vector;Frameerror = Biterror;% frameerror number of false frames;Iternumtotal = Zeros (1,length (ebn0_db));% iternumtotal Total iterations count, vector;Info_length = 1024;% info_length information bit lengthrate = 1/2;% rate bitrateSize_m = 512;% m matrix size (Reference CCSDS documentation)

Open (new) file, save running data

file_name = [' Ldpc_ccsds_ ' datestr (now,' YYYYMMDD '.txt '];fid = fopen (file_name,' at+ ') ); fprintf (FID,' date%s\n ', Datestr (now,' YYYYMMDD ')); fprintf (FID,'%s\n ',' Ccsds LDPC Standard in Section3 Code, 06 Edition '); fprintf (FID,' information bit length =%d, ', info_length); fprintf (FID,' bitrate =%d, ' , rate);

The h is the check matrix, and g is the generation matrix. By calling a function to implement

H = Ccsdscheckmatrix (size_m,rate); G = Ccsdsgeneratematrix (h,size_m,rate);

Decoding preparation

[R_mark,c_mark] = find (h~=0); Hcolnum = SUM (H); Hrownum = cell (1,size (h,1));  for rowh = 1:size (h,1)    Hrownum{rowh} = Find (R_MARK==ROWH);  End
BER Simulation

Simulation of BER under different EbN0

 for nEbN0 = 1:length (ebn0_db)

Multi-frame averaging of statistics

     for Nf=1:frames_num

Encoding process

        message = Randi ([0 1],1,info_length);        Encodedata = mod (message*g,2);

Modulation

        transmitsignal = 2*encodedata-1;   % map 0--1; 1-+1        Transmitsignalpower = sqrt (var (transmitsignal));        Transmitsignal = Transmitsignal/transmitsignalpower; % Normalization

AWGN Channel, SNR and EbN0 conversion relationship

        snr_db = ebn0_db ((nEbN0)) + 10*LOG10 (2) +10*log10 (rate);        SNR = 10^ (SNR_DB/10);        Noise = Randn (1,length (transmitsignal));        Noise = Noise/sqrt (SNR);     %snr conversion, plus noise        Receivesignal = transmitsignal + noise;

According to the CCSDS document, there are actually m symbols that are not transmitted, where the value is 0, which is equivalent to the simulation.

        Receivesignal (end-1*size_m+1:end-0*size_m) = 0;

Decoding, can call different functions

[Iternum,recoverdata] =...Ldpcdecoderllr (H,hrownum,hcolnum,receivesignal,snr,max_iter_num);%LDPCDECODERBP1 (h,hrownum,hcolnum,receivesignal,snr,max_iter_num);            %ldpcdecoderminsum (h,hrownum,hcolnum,receivesignal,snr,max_iter_num);        % file Output        if(nebn0==1 && nf==1) fprintf (FID,' decoding program for ldpcdecoderllr\n '); fprintf (FID,' Maximum iteration count =%d, ', Max_iter_num); fprintf (FID,' \ n-------------------------------\ n '); fprintf (FID,' ebn0\t total frame number \ t error frame number \ t error bit number \ t average iterations \ t error bit rate \ t error frame rate \ n ');% matlab readtable stupid don't know Chinese, so play a line for him to seefprintf (FID,' ebn0\t t_frame\t e_frames\t e_bits\t a_iternums\t ber\t fer\n ');End

Number of false bits, number of missed frames, and number of iterations

        ...            SUM (ABS (Message-recoverdata (1:length (message)));        ...            (SUM (ABS (Encodedata-recoverdata (1:length (encodedata))) ~=0);        Iternumtotal (nEbN0) = Iternumtotal (nEbN0) + iternum;

Stop condition and file output

         if(Frameerror (nEbN0) >=max_error_frame | | nf==frames_num)            BER (nEbN0) = Biterror (nEbN0)/nf/length (message); fprintf (FID,'%3.2g\t%5d\t%4d\t ', ebn0_db (nEbN0), Nf,frameerror (nEbN0)); fprintf (FID,'%8d\t%8.6g\t ', Biterror (nEbN0), Iternumtotal (nEbN0)/nf); fprintf (FID,'%e\t%e\n ', BER (nEbN0), Frameerror (nEbN0)/nf); Break;End         if(MoD (nf,100) ==0)            BER (nEbN0) = Biterror (nEbN0)/nf/320; fprintf (FID,' \ n-------------------------------\ n '); fprintf (' eb/no =%e \ n ', ebn0_db (nEbN0)); fprintf (' Total number of frames =%d, ', NF); fprintf (' number of missed frames =%d, ', Frameerror (nEbN0)); fprintf (' number of false bits =%d, ', Biterror (nEbN0)); fprintf (' Maximum iteration count =%d, ', Max_iter_num); fprintf (' Average iteration count =%e, ', Iternumtotal (nEbN0)/nf); fprintf (' bit error rate =%g, ', BER (nEbN0)); fprintf (' ERROR frame rate =%g \ n ', Frameerror (nEbN0)/nf);End
    End
End
Simulation results

Through the code after the actual error rate comparison chart, do not look at the figure below, the figure is not simulated, too slow

Fclose (FID); Readtable (file_name,' Headerlines ', 6,' Delimiter ',' \ t ') semilogy (ebn0_db, BER,' R '); Xlabel (' eb/n0 (DB) '); Ylabel (' BER 'on;
Ans =     EbN0    t_frame    e_frames    e_bits    a_iternums    BER    FER    ____    _______    ________    ___    __________    ___    1       1          0           0            0      0  


Published with MATLAB? r2014a

CCSDS standard LDPC compiler code emulation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.