function [LT_brate, NT_brate, LT_margin, NT_margin,TPSD_LT,TPSD_NT]=calcResultSDSL(tfplan,res,lc,f) %% =========================================================================== % calcResultSDSL - calculates SDSL (using PAM) bitrates and margins % % Parameter: tfplan The TF plan used for calculating the bit rate % Parameter: res Result structure % Parameter: lc The linecode % Parameter: f Frequency axis % % Returns: LT and NT bitrates [Mbit/s] % LT and NT margins [dB] %% =========================================================================== %% =========================================================================== % Copyright (C) 2000-2009 by Forschungszentrum Telekommunikation Wien, Austria; % All rights reserved. % Project : FTW's xDSLsimu % Author(s) : Tomas Nordstrom (Tomas.Nordstrom@FTW.at) % : Gernot Schmid (schmid@ftw.at) % %% =========================================================================== % Change History % 2000-03-23 (GS) Created % 2000-04-12 (GS) Extensions for applying a receive filter % 2000-05-03 (ToNo) Modified the input parameters % 2000-05-17 (GS) Alternative margin calculation methods % 2000-05-23 (GS) % 2000-06-20 (ToNo) Cleaning up % 2000-07-11 (ToNo) Made it clip SNR % 2003-12-02 (ToNo) Added support for lc dependent modem noise % 2008-04-18 (ToNo) Added support for return of actual true Tx PSDs % 2008-08-28 (ToNo) Introduced consistent naming (pam -> mod; bpsym) %% =========================================================================== usefilters=0; % zero if no receive filter should be applied %efficiencyLoss = lc.param.efficiencyLoss; SNRmax_dB = lc.param.SNRMax; xtalk_margin = lc.param.xtalk_margin; signal_margin = lc.param.signal_margin; %NOT-USED Px = lc.param.Px; bpsym = lc.param.mod.bpsym; reqSNR = lc.param.reqSNR; % (Includes codingGain and SNRloss) % Considered bitrates brate=lc.param.mod.brate.rate; ohead=lc.param.mod.brate.ohead; % with UC 16-PAM we get 3 = log2(16)-1 bits/symbol fsym=(brate+ohead)/bpsym; %% =========================================================================== % Recieve filter if usefilters, % Find correct values in templates for receive filter data % (dep. on bitrate if symmetric or asymmetric SDSL is used) switch tfplan.name case 'SDSL-asym' tmpRxN_up=lc.param.mod.recfilterorder.up(1,:); tmpind=find(tmpRxN_up>brate); RxN_up=lc.param.mod.recfilterorder.up(2,tmpind(1)-1); tmpRxN_dn=lc.param.mod.recfilterorder.dn(1,:); tmpind=find(tmpRxN_dn>brate); RxN_dn=lc.param.mod.recfilterorder.dn(2,tmpind(1)-1); tmpRx3dBf_up=lc.param.mod.recfilter3dBf.up(1,:); tmpind=find(tmpRx3dBf_up>brate); Rx3dBf_up=lc.param.mod.recfilter3dBf.up(2,tmpind(1)-1); tmpRx3dBf_dn=lc.param.mod.recfilter3dBf.dn(1,:); tmpind=find(tmpRx3dBf_dn>brate); Rx3dBf_dn=lc.param.mod.recfilter3dBf.dn(2,tmpind(1)-1); case 'SDSL-sym' RxN_up=lc.param.mod.recfilterorder.up; RxN_dn=lc.param.mod.recfilterorder.dn; Rx3dBf_up=lc.param.mod.recfilter3dBf.up; Rx3dBf_dn=lc.param.mod.recfilter3dBf.dn; end RxTrcutoff=lc.param.mod.highpass3dBf; % Receive filter frequency response Rec_Filt_up= 1./(1+(f./Rx3dBf_up).^(2*RxN_up)).*f.^2./(f.^2+RxTrcutoff.^2); Rec_Filt_dn= 1./(1+(f./Rx3dBf_dn).^(2*RxN_dn)).*f.^2./(f.^2+RxTrcutoff.^2); %Apply the recieve filters: NT_Rx=res.NT.Rx_signal.*Rec_Filt_dn; LT_Rx=res.LT.Rx_signal.*Rec_Filt_up; NT_TotNoise=res.NT.Tot_noise.down.*Rec_Filt_dn; LT_TotNoise=res.LT.Tot_noise.up.*Rec_Filt_up; else % No filter NT_Rx=res.NT.Rx_signal; LT_Rx=res.LT.Rx_signal; NT_TotNoise=res.NT.Tot_noise.down; LT_TotNoise=res.LT.Tot_noise.up; end; %% =========================================================================== % Calculate SNR (with cross-talk margin and SNR maximum) % The total noise is increased by xtalk_margin dB:s, % and is not in the ShannonGap. noise_LT=LT_TotNoise.*10.^(xtalk_margin/10); noise_NT=NT_TotNoise.*10.^(xtalk_margin/10); % Add modem noise if isfield(lc.param,'modemNoise') noise_LT = noise_LT + 10.^(eval([lc.param.modemNoise.LT ';'])/10); noise_NT = noise_NT + 10.^(eval([lc.param.modemNoise.NT ';'])/10); end; SNR_LT = (LT_Rx)./(noise_LT); SNR_NT = (NT_Rx)./(noise_NT); % Clip at SNRmax SNRmax = 10.^(SNRmax_dB/10); tmp=find(SNR_LT>=SNRmax); SNR_LT(tmp)=ones(size(tmp)).*SNRmax; tmp=find(SNR_NT>=SNRmax); SNR_NT(tmp)=ones(size(tmp)).*SNRmax; %% =========================================================================== % Ideal DFE margin calculation ('folded SNR stuff') % Calc the folded SNR SumSNR_LT=calcFoldedSNR(SNR_LT,f,fsym); SumSNR_NT=calcFoldedSNR(SNR_NT,f,fsym); %% =========================================================================== % Values for function output arguments % (to fit this function to CALL from calcXDSLresult) NT_margin = SumSNR_NT - reqSNR - signal_margin; % in dB LT_margin = SumSNR_LT - reqSNR - signal_margin; LT_brate = brate/1e6; % in Mbps NT_brate = brate/1e6; TPSD_NT=res.NT.Tx_signal; TPSD_LT=res.LT.Tx_signal;