[Power Control] MATLAB Simulation of Power Control of Closed-Loop Link in Wireless Optical Communication-CDMA

1. Software version

matlab2017b

2. Theoretical knowledge of this algorithm

Write the power control error ( Power control error ) program of the closed-loop link in       wireless optical communication-CDMA , and its definition is explained in detail in the document An Analytical Approach for Closed-Loop Power Control Error Estimations in CDMA Cellular Systems. And it is simulated that the power control error ( Power control error ) is under different modulation modes of OOK 2PPM 4PPM 8PPM 16PPM ; and the power control error ( Power control error ) is different at 1/4 code rate, 1/2 code rate, 3/4 code rate The relationship between code rate and BER . The channel is set in the AWGN environment, and the initial value is subject to the main program of wireless optical communication handed over to you.

 The final result shows:

A graph of the distance and BER between the UE and the base station in a wireless optical communication-CDMA system without power control .

A graph of the distance and BER between the UE and the base station in a system with power control .

A BER curve diagram of power control error under different modulation methods,

A BER graph of power control error at different code rates.

Different modulation methods and code rates are marked with different colors, the modulation method is in one picture, and the code rate is in one picture.

    First, according to the reference

Regarding the background and related theoretical knowledge of power control error estimation, we meet the following conditions when designing:

Here, only one base station and several users are considered, so only the path fading model in the CDMA environment is considered.

3. Core code

 

clc;
clear;
close all;
warning off;
addpath 'func\'

%%
%参数初始化 
global PACKET_LENGTH;
global SLOT_LENGTH ;                                                                            
global pulse_drtn;
global CHANNELS;                                                  
global PEEK_POWER;
global SYMBOL_LENGTH;                                 
global TRANS_LENGTH;

PACKET_LENGTH  = 300;  %Packet size 
PEEK_POWER     = 1;
SYMBOL_LENGTH  = 36;   %here symbol length= packet length 
SLOT_LENGTH    = 4;  
TRANS_LENGTH   = 9*SLOT_LENGTH*PACKET_LENGTH;
pulse_drtn     = 4;
CHANNELS       = 3;
ELECTRON       = 1.6e-19;
INTERFERENCE   = 1e-3;
RECEIVER_RES   = 0.53;
COEF_RED       = 0.1550;
COEF_GREEN     = 1.7309;
COEF_BLUE      = 1.1142;
RES_RED        = 0.5200;
RES_GREEN      = 0.4800;
RES_BLUE       = 0.4000;
%Derived parameters 
bit_rate       =  4e8;                          % bit rate [100Mbps]  
rms_delay      =  2e-9;                         % delay spread (1 ns)                                                      
multipath      =  3;                            % multi-path dispersion
sample_rate    =  bit_rate / 3.0 * SLOT_LENGTH;
%struct built
for i=1:CHANNELS
    sentbit(i,:)  = zeros(1,3*PACKET_LENGTH);
    signal(i,:)   = zeros(1,TRANS_LENGTH);
    recivbit(i,:) = zeros(1,3*PACKET_LENGTH);
end


dwTransmitPower           = 7;        % 发送功率
dShadowFadingStd          = 4;        % 阴影衰落标准差BS2UE dB
dUserVelocity             = 0;        % 用户移动速度0km/h,这里假设是静止的
dwMsTransmitPower         = 0.25;     % 移动台发送功率 W
MAX_Dis                   = 7;
STEP                      = 0.2;
MIN_Dis                   = 1;

DIS                       = [MIN_Dis:STEP:MAX_Dis];%定义用户和基站之间的距离
MTKL                      = 10;%多次仿真,计算平均值
%**************************************************************************

%%
%主题函数,通过for循环,仿真不同距离下的误码率曲线
%为了对比,我们设置三组不同的SNR下的AWGN进行仿真
for jj = 1:length(DIS) 
    for mm = 1:MTKL
        jj
        mm
        %根据路径距离计算路径损耗
        PASS_LOSS = dwTransmitPower - Path_lose_compute(DIS(jj)) - dShadowFadingStd;

        %计算光三组元色对应的SNR值
        snr_red   = 10*log10(power((power(10,PASS_LOSS/10)*1e-3)*(COEF_RED  /(COEF_RED+COEF_GREEN+COEF_BLUE)),2)/((ELECTRON*INTERFERENCE/RES_RED)  *(bit_rate*(SLOT_LENGTH/pulse_drtn)/3.0)));
        snr_green = 10*log10(power((power(10,PASS_LOSS/10)*1e-3)*(COEF_GREEN/(COEF_RED+COEF_GREEN+COEF_BLUE)),2)/((ELECTRON*INTERFERENCE/RES_GREEN)*(bit_rate*(SLOT_LENGTH/pulse_drtn)/3.0)));
        snr_blue  = 10*log10(power((power(10,PASS_LOSS/10)*1e-3)*(COEF_BLUE /(COEF_RED+COEF_GREEN+COEF_BLUE)),2)/((ELECTRON*INTERFERENCE/RES_BLUE) *(bit_rate*(SLOT_LENGTH/pulse_drtn)/3.0)));
        VarR      = calc_snr(snr_red);
        VarG      = calc_snr(snr_green);
        VarB      = calc_snr(snr_blue);

        %产生随机数作为发送数据
        for i=1:CHANNELS
            sentbit(i,:) = round(rand(1,3*PACKET_LENGTH)); 
        end

        %调制,OPPM 
        for i=1:CHANNELS
            signal(i,:) = func_OPPM(sentbit(i,:));
        end
        %加多径
        if multipath~=1 
           for i=1:CHANNELS
               signal(i,:) = add_multipath_dispersion1(signal(i,:),TRANS_LENGTH,sample_rate,rms_delay);
           end
        end
        %加噪声
        signal(1,:)=add_gauss_noise(signal(1,:),TRANS_LENGTH, VarR);      
        signal(2,:)=add_gauss_noise(signal(2,:),TRANS_LENGTH, VarG);
        signal(3,:)=add_gauss_noise(signal(3,:),TRANS_LENGTH, VarB); 


        %解调
        for i=1:CHANNELS
            recivbit(i,:) = func_deOPPM(signal(i,:));
        end

        for i=1:CHANNELS
            error(i,:) = size(find(recivbit(i,:)~=sentbit(i,:)),2);
        end
        ERR(mm) = (error(1,:)+error(2,:)+error(3,:))/(CHANNELS*3*PACKET_LENGTH);
    end
    ber(jj) = mean(ERR);
end
%**************************************************************************

%%
%画出波形
figure;
semilogy(MIN_Dis:STEP:MAX_Dis,ber,'b-o');
axis([DIS(1) DIS(end) 10^(-5) 1])
xlabel('distance(Km)');
ylabel('Bit Error Rate');
grid on

%保存数据,用于和加功率控制模块的对比
save Ber_with_no_power_control_error.mat MIN_Dis STEP MAX_Dis ber
%**************************************************************************

4. Operation steps and simulation conclusion

Here, we mainly simulate the five methods of OOK, 2PPM, 4PPM , 8PPM and 16PPM . Here we still consider the original simulation method, that is, change the power value in a fixed position for simulation, which is the same as the previous VLC-OOK Simulation ideas.

Comparing the above five modulation methods together, the simulation results obtained are as follows:

 The relationship between BER and BER under different code rates of 1/4 code rate, 1/2 code rate, and 3/4 code rate . Here, on the basis of the original code, the simulation of different code rates is performed.

5. References

 

A01-57

6. How to obtain the complete source code

Method 1: Contact the blogger via WeChat or QQ

Method 2: Subscribe to the MATLAB/FPGA tutorial, get the tutorial case and any 2 complete source code for free

Guess you like

Origin blog.csdn.net/ccsss22/article/details/123944254