function [LT_brate, NT_brate, LT_margin, NT_margin,TPSD_LT,TPSD_NT]=calcResultHDSL(tfplan,res,lc,f) %% =========================================================================== % calcResultHDSL - calculates HDSL (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) % % CVS: $Id: calcResultHDSL.m,v 1.2 2005/01/04 10:32:28 tono Exp $ %% =========================================================================== % Change History % 2003-11-25 (ToNo) Created based on calcResultSDSL % 2003-12-02 (ToNo) Added support for lc dependent modem noise % 2008-04-18 (ToNo) Added support for return of actual true Tx PSDs %% =========================================================================== SNRmax_dB = lc.param.SNRMax; xtalk_margin = lc.param.xtalk_margin; signal_margin = lc.param.signal_margin; modulation = lc.param.modulation; reqSNR = lc.param.reqSNR; % Considered bitrates brate = lc.param.mod.brate.rate; ohead = lc.param.mod.brate.ohead; fsym = (brate+ohead)/lc.param.mod.bpsym; % 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; %% =========================================================================== % 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 exist('lc.param.modemNoise.LT')~=1 noise_LT = noise_LT + 10.^(eval([lc.param.modemNoise.LT ';'])/10); noise_NT = noise_NT + 10.^(eval([lc.param.modemNoise.NT ';'])/10); end; % Now the SNR 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,modulation); SumSNR_NT = calcFoldedSNR(SNR_NT,f,fsym,modulation); %% =========================================================================== % 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;