⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chan_generator.m

📁 无线仿真Matlab代码
💻 M
字号:
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %   Copyright (c) __year__ Ericsson Telecommunicatie B.V. %   All rights reserved. %    %   Redistribution and use in source and binary forms, with or without %   modification, are permitted provided that the following conditions %   are met: %   1. Redistributions of source code must retain the above copyright %       notice, this list of conditions and the following disclaimer. %   2. Redistributions in binary form must reproduce the above copyright %       notice, this list of conditions and the following disclaimer in the %       documentation and/or other materials provided with the %       distribution. %   3. Neither the name of Ericsson Telecommunicatie B.V. may be used %       to endorse or promote products derived from this software without %       specific prior written permission. %    %    %   THIS SOFTWARE IS PROVIDED BY ERICSSON TELECOMMUNICATIE B.V. AND %   CONTRIBUTORS "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, %   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF %   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. %   IN NO EVENT SHALL ERICSSON TELECOMMUNICATIE B.V., THE AUTHOR OR HIS %   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, %   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, %   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR %   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY %   OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT %   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE %   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. %    %    %   Contact for feedback on EURANE: eurane@ti-wmc.nl %   EURANE = Enhanced UMTS Radio Access Network Extensions %   website: http://www.ti-wmc.nl/eurane/ %%   ***************************************************************************%%   UMTS-HSDPA channel generator main function%              %   Create input trace(s) and the BLER table that can next be used as %   input for the ns-2 network simulator.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Clear workspaceclear all;close all;% Set-up parameters parameters;                                                    % get power profile[profile,spectrum] = environment(multi,-20);% Determine parameters for multipath fadingfD = vel_mps/lambda;                                                    % maximum Doppler shiftrayleigh_fades = 2*round(dur*fD/2);                               % fades during simulation (must be even)samples_per_TTI = ceil(rayleigh_fades*samples_per_fade/numTTI);   % Number of samples per TTIif (samples_per_TTI > max_samples_per_TTI)    samples_per_TTI = max_samples_per_TTI;endsamples = numTTI*samples_per_TTI;                                 % Total number of samples% Determine parameters for shadowingalpha = exp(-vel_mps*TTIdur/d_corr);                              %velocity *TTIdur=distance beta  = sqrt(1-alpha^2);% Loop generation of tracesfor n = 1:nr_usersdisplay('Output generation for user:'),n    % Set random generator    randn('state',n);        % Generate multipath traces per tab    n_tabs = size(profile,2);    omega_2 = zeros(numTTI,n_tabs);        for ii = 1:n_tabs        % Generate multipath        omega = multipath(samples,rayleigh_fades,fD,spectrum);        % Average samples per TTI        omega_2(:,ii) = sum(reshape(omega,samples_per_TTI,numTTI))'*profile(ii)/samples_per_TTI;    end    % Find resulting power in Rake receiver (in dB)    P_ff = 10*log10(sum(omega_2,2));    % In P_ff the sharp dips are negative, i.e. P_ff is the received power.    % A high positive value of P_ff indicates a good channel condition    % We compute the total path loss, containing the     % fast fading, slow (=shadow) fading, distance loss and     % base station antenna gain (GT, in dBi)    % The shadowing is changing over time. The other three contributions are constant.    Ploss = -P_ff + shadowing(numTTI,shadow_std,alpha,beta)+distloss-GT;    % The received power, P_out, is based on:     % transmission power, PTx      (scalar constant; in dBm)    % intra-cell interference      (scalar constant; in dBm)    % inter-cell interference      (scalar constant; in dBm)    % power loss, Ploss            (varying over time; in dB)    P_out=PTx-10*log10((10^(Iintra/10))+(10.^((Iinter+Ploss)/10)));     % Based on the received power, P_out, we next compute the total     % received power for the retransmissions(RT).    % P_1stRT=MRC{P(t),P(t+H)}    % P_2dnRT=MRC{P(t),P(t+H),P(t+2*H)}    % with MRC=Maximum Ratio Combining function and H=HARQcycle    P_1stRT = Power1stRT(numTTI,P_out,HARQcycle);      P_2ndRT = Power2ndRT(numTTI,P_out,HARQcycle);       % And for the evaluation of the number of HARQ retransmissions, consider what     % happens if you introduce a third REtransmission (i.e. a fourth Transmission)    P_3rdRT = Power3rdRT(numTTI,P_out,HARQcycle);       % Compute the CQI vector (integer values)    % CQI and P_out are vectors    % CQIdelayinTTI is the number of TTI's that is in between the UE measurement and     % the actual moment of using this information at the Scheduler in the Node B.     % So, CQI(t) is the CQI based on which TBS (Transport Block Size) of the     % transmission at TTI t with channel condition P_out(t) is chosen.     % Define the minimum and maximum CQI value allowed (see 3GPP standards).    % Note that for some user types, the TBS for CQI values 22 to 30 is the same.    % But this is implemented in the ns-2 simulator.    minCQI=0    maxCQI=30                   [CQI,perctoolow,perctoohigh] = compCQI(numTTI,P_out,CQIdelayinTTI,minCQI,maxCQI);                                 % Save the traces that will next be used in ns-2 link level simulations    savetraceend    %end loop over the number of users    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -