function [add_noise_LT, add_noise_NT] = evalNoise(f, NT_node, LT_node, ... start_node, stop_node, tot_len, Att_mtr, PSD_up, PSD_down, XTlevel) %% =========================================================================== %evalNoise - Calculates noise in LT and NT nodes from disturber in % start to stop node PSD_up and PSD_down disturbers PSD masks % % INPUT % ------ % f : Frequency axis % NT_node : NT node of victim modem % LT_node : LT node of victim modem % start_node: LT node of disturber % stop_node : NT node of disturber % tot_len : Length vector, % tot_len(n)=distance to node n from the first node % tot_Att : Attenuation model in dB/km matrix % PSD_up : Disturber PSD transmitted from NT end % PSD_down : Disturber PSD transmitted from LT end % XTlevel : structure that contains NEXT,FEXT,thirdCXT values % % OUTPUT % ------- % add_noise_LT(.NEXT .FEXT .thirdCXT): Noise to be added in LT end % add_noise_NT(.NEXT .FEXT .thirdCXT): Noise to be added in NT end % % Example(s): % % % Algorithmic details: % Step 1: Calculate noise in LT end % Step 1.1: NEXT from PSD_down % Step 1.2: FEXT from PSD_up % Step 1.3: 3CXT from PSD_up % % Step 2: Calculate noise in NT end % Step 2.1: NEXT from PSD_up % Step 2.2: FEXT from PSD_down % Step 2.3: 3CXT from PSD_down % % % Reference: % FTW's xDSLsimu manual %% =========================================================================== %% =========================================================================== % Copyright (C) 1998-1999 by Telia Research AB, Lulea, Sweden; % 2000-2009 by Forschungszentrum Telekommunikation Wien, Austria; % All rights reserved. % Project : FTW's xDSLsimu % Author(s) : Tomas Nordstrom (Tomas.Nordstrom@FTW.at) % : Daniel Bengtsson (Daniel.J.Bengtsson@Telia.se) % : Bo Engstrom (bosse@upzide.com) % % CVS: $Id: evalNoise.m 752 2009-01-02 13:03:52Z tono $ %% =========================================================================== % Change History % 1998-12-16 (DaB) Created % 1998-12-22 (ToNo) Added and updated comments % 1999-01-08 (DaB) Bug fixed in DS FEXT % 1999-01-12 (DaB) Fixed bug in US NEXT % 1999-02-04 (DaB) Multiple cables allowed % 1999-02-04 (DaB) added input parameter to control % XTlevel (NEXT,FEXT,thirdCXT) % 1999-02-04 (DaB) Added 3CXT noise % 1999-02-09 (DaB) Fixed NEXT FEXT thirdCXT add bug % 1999-03-10 (DaB) Rewritten to optimize speed % 1999-03-30 (DaB) Bug correction % 1999-08-11 (DaB) Updated for Bridgetap calc % 2001-06-19 (Bosse) Octave port % 2001-07-01 (PeKa) Octave to Matlab compatibility port % 2001-09-11 (ToNo) Added support for "4 order" NEXT term % 2001-10-08 (ToNo) Made "4 order" NEXT flag global, % and made some editorial changes. % 2001-12-05 (ToNo) Fixed 4-order term to be |H|^2^2 instead of |H|^2^4 % 2002-08-01 (ToNo) Speed things up by reducing duplicated calculations % 2003-11-03 (ToNo) Lists now use cell arrays for both Octave and Matlab % 2005-07-10 (ToNo) Implemented non-standard slanting for NEXT and FEXT % Cleaned up unused conditions, a variable, and comments %% =========================================================================== f1MHz = f./1e6; log10f1MHz = log10(f1MHz); x25log10f1MHz = 25.*log10f1MHz; % Hard coded 3cXT slant % -------------------------------- % Step 1: Generate noise at the LT end % -------------------------------- %----------------------------- % Step 1.1: NEXT from PSD_down %----------------------------- tmp=zeros(size(f)); if (NT_node>start_node) && (LT_nodeLT_node, att=Att_mtr{LT_node,start_node}; if NT_node>stop_node, % Determine the common loop att attL=Att_mtr{start_node,NT_node}; else attL=Att_mtr{start_node,stop_node}; end else att=Att_mtr{start_node,LT_node}; if NT_node>stop_node, % Determine the common loop att attL=Att_mtr{LT_node,NT_node}; else attL=Att_mtr{LT_node,stop_node}; end end; if XTlevel.NEXTx4, dB_xtalk=XTlevel.NEXT+... XTlevel.NEXTslant*log10f1MHz+ ... 10*log10(1-10.^(2*attL/10))+att; else dB_xtalk=XTlevel.NEXT+XTlevel.NEXTslant.*log10f1MHz+att; end; xtalk=10.^(dB_xtalk/10); tmp=xtalk.*PSD_down; end; % if add_noise_LT.NEXT=tmp; %--------------------------- % Step 1.2: FEXT from PSD_up %--------------------------- tmp=zeros(size(f)); if (LT_node>=start_node)&&(NT_node<=stop_node), len_fext=tot_len(NT_node)-tot_len(LT_node); if len_fext~=0, att=Att_mtr{LT_node,stop_node}; dB_xtalk=XTlevel.FEXT+XTlevel.FEXTslant.*log10f1MHz+... 10.*log10(len_fext)+att; xtalk=10.^(dB_xtalk/10); tmp=xtalk.*PSD_up; end; % if elseif (start_nodestart_node) && (LT_nodestop_node, att=Att_mtr{stop_node,NT_node}; if LT_node>start_node, % Determine the common loop att attL=Att_mtr{LT_node,stop_node}; else attL=Att_mtr{start_node,stop_node}; end else att=Att_mtr{NT_node,stop_node}; if LT_node>start_node, % Determine the common loop att attL=Att_mtr{LT_node,NT_node}; else attL=Att_mtr{start_node,NT_node}; end end; if XTlevel.NEXTx4, dB_xtalk=XTlevel.NEXT+... XTlevel.NEXTslant.*log10f1MHz+ ... 10*log10(1-10.^(2*attL/10))+att; else dB_xtalk=XTlevel.NEXT+XTlevel.NEXTslant.*log10f1MHz+att; end xtalk=10.^(dB_xtalk/10); tmp=xtalk.*PSD_up; end; %if add_noise_NT.NEXT=tmp; %----------------------------- % Step 2.2: FEXT from PSD_down %----------------------------- tmp=zeros(size(f)); if (LT_node>=start_node)&&(NT_node<=stop_node), len_fext=tot_len(NT_node)-tot_len(LT_node); if len_fext~=0, att=Att_mtr{start_node,NT_node}; dB_xtalk=XTlevel.FEXT+XTlevel.FEXTslant.*log10f1MHz+... 10.*log10(len_fext)+att; xtalk=10.^(dB_xtalk/10); tmp=xtalk.*PSD_down; end; %if elseif (start_node