ADSL, VDSL, and Multicarrier Modulation . John A. C. Bingham Copyright # 2000 John Wiley & Sons, Inc. Print ISBN 0-471-29099-8 Electronic ISBN 0-471-20072-7
APPENDIXA
MATLAB PROGRAMS FOR xDSL ANALYSIS
NOTES:
1. For easier reading all comments are italicized, and all input statements are bold 2. All nested blocks of “for” and “if” statements are progressively indented
A.1 FREQUENCY-DOMAIN ANALYSIS: RESPONSE AND INPUT IMPEDANCES
% Calculates response, input impedances and return losses of HPF/loop/HPF; hold off;
nfdf input(`[number of freqs freq increment] ‘);
% If nfreq is a power of 2 it will facilitate calculation of IR by IFFT; nfreq nfdf(1); df nfdf(2);
f dfÃ[0:nfreqÀ1];
f(1) 1e-6; % To avoid dividing by zero;
j sqrt(À1); jomega jÃ2ÃpiÃf;
% De®ne unit vector and zero vector;
Uv ones(1,nfreq); Zv zeros(1,nfreq);
Rterm 0.1; Gterm 10.;
% RL parameters [Rzero, fr, Lzero, Linf, fm, b, C];
% Rows 1 and 2 are for 1 kft of 24 AWG, 26 AWG; (add your own rows to the matrix); RL [.0537 .147 .187 .129 .697 .819 15 .7;.0836 .217 .187 .134 .870 .847 15.7]; % Note: C is the same for all gauges of US UTPs; it may not be for other UTPs khpf input(‘With high-pass ®lter(1), without(0) ‘);
if khpf;
LC input(`[Transformer inductance, Series capacitance] ‘);
Ahpf Uv; Bhpf Uv./( jomega*LC(2));
Chpf Uv./(jomegaÃLC(1)); Dhpf Uv Bhpf.ÃChpf;
% Note: Source and load highpass ®lters are assumed the same;
%programcouldbegeneralizedtoallowdifferent®lters
%InitializationofMwithHPF:
A Ahpf; B Bhpf;
C Chpf; D Dhpf;
253
else; % Initialization of M without HPF
A Uv; B Zv;
C Zv; D Uv;
end; % if khp
% Initialization of image attenuation (derived from gammas of in-line sectons); dBimage=Zv;
nsect input(‘Number of sections ‘);
% De®nition of loop, section by section from CO to RT, and build up of A, B, C, and D for n 1:nsect;
LGT input(‘[Length in kft, Gauge row, Type(1=in-line, 2=b-t)] ‘); leng LGT(1); row LGT(2); type LGT(3);
% R per unit length according to equation (3.8);
Rper RL(row,1)Ã(Uv (f/RL(row,2)).^2).^0.25;
%xb (f/fr)^b;
xb (f/RL(row,5)).^RL(row,6);
% L per unit length according to equation (3.9);
Lper (RL(row,3)ÃUv RL(row,4)Ãxb)./(Uv xb);
Cper RL(row,7);
Zseries jomega.ÃLper Rper;
Yshunt jomegaÃCper;
Z0 sqrt(Zseries./ Yshunt);
gamma leng*sqrt(Zseries.ÃYshunt);
if LGT(3) 1; % In-line section
An cosh(gamma); Bn Z0.Ãsinh(gamma);
Cn sinh(gamma)./Z0; Dn An;
dBimage dBimage-8.686Ã(real(gamma));
else; % Bridge tap
An Uv; Bn Zv;
Cn tanh(gamma)./Z0; Dn Uv; % bridge tap
end; % if type
Atemp A.ÃAn B.ÃCn; B A.ÃBn B.ÃDn;
Ctemp C.ÃAn D.ÃCn; D C.ÃBn D.ÃDn;
A Atemp;
C Ctemp;
end; % end of loop on n
if khpf; % Add hpf at RT;
Atemp A.ÃDhpf B.ÃChpf; B A.ÃBhpf B.ÃAhpf;
Ctemp C.ÃDhpf D.ÃChpf; D C.ÃBhpf D.ÃAhpf;
A Atemp;
C Ctemp;
% Note: The load high-pass ®lter is the mirror image of the source one, % so Ahpf and Dhpf are interchanged
end; % if khp
% Check that AD-BC 1; Erase these lines when con®dence is established!; determ A.ÃD-B.ÃC;
plot(f,real(determ),f,imag(determ)); grid on; ®gure(gcf); pause;
% Response
Hsq abs(2ÃUv./(A BÃGterm CÃRterm D)).^2; save response nfreq f Hsq totleng;
% Can be used as input to A2.m for capacity calculations plot(f,10Ãlog10(Hsq)); ®gure(gcf); grid on; hold on; plot(f(1:50:nfreq),dBimage(1:50:nfreq),’x');
xlabel (`MHz’); ylabel(`Loss dB’); pause; hold off;
LOOP CAPACITY 255
% Image attenuation is superimposed to show that match is good IF there are no b-ts
% Input impedances and return losses;
ZinCO (AÃRterm B)./(CÃRterm D);
ZinRT (DÃRterm B)./(CÃRterm A);
RLCO 20Ãlog10(abs((ZinCO Rterm)./(ZinCO-Rterm)));
RLRT 20Ãlog10(abs((ZinRT Rterm)./(ZinRT-Rterm)));
plot(f,RLCO,f,RLRT); grid on; ®gure(gcf); hold on;
plot(f(nfreq),RLCO(nfreq),’o',f(nfreq),RLRT(nfreq),’x');
xlabel(‘MHz’); ylabel(‘Return loss dB’);
title(‘Return losses relative to Rterm: RLCO(o); RLRT(x)’); pause; hold off
A.2 LOOP CAPACITY
Note : This program is a very simple example of the calculation of capacities; the reader is encouraged to develop more useful ones that include VDSL systems, mixes of services and loop lengths, spectral management of transmit PSDs, real roll-off ®lters, and so on.
% Calculates ADSL capacities with ISDN, HDSL and ADSL crosstalk
% Assumes that response and total length of loop have been calculated
% and stored as “Hsq” and “totleng”
BitCap input(‘[Bitcapdown Bitcapup] ‘);
mardB input(‘(margin-coding gain) dB ‘);
alpha 0.12Ã10^(-mardB/10);
f .0043125Ã[1:256];
fsq f.^2;
¯pt5 f.^1.5;
Uv ones(1,256); Zv zeros(1,256);
hold off;
% Numbers of crosstalkers;
nXT input(`(nI nH nA)’);
nI nXT(1); nH nXT(2); nA nXT (3);
% PSDs and crosstalk
% ISDN BRI
f0 .08; f3dB .08;
IPSD (2Ã26/80000)Ã((sin(piÃf/f0)./(piÃf/f0)).^2)./(Uv (f/f3dB).^4); IN (0.8e-5)ÃIPSD.ïpt5+le-15;
IF (0.8e-5)ÃtotlengÃIPSD.ÃHsq.Ãfsq; % Probably negligible IXT IN IF le-15;
% HDSL
f0 .392; f3dB .196;
HPSD (2Ã30/(392000))Ã((sin(piÃf/f0)./(piÃf/f0)).^2)./(Uv (f/f3dB).^8); HN (0.8e-5)ÃHPSD.Ãf1pt5;
HF (0.8e-5)ÃtotlengÃHPSD.ÃHsq.Ãfsq;
HXT HN HF 1e-15;
% ADSL;
kEC input(`FDD(0) or EC(1)?’);
if kEC 1; nmind 7; nmaxu 31;
else; nmind 36; nmaxu 28;
end;
f3dB 1.104; % Downstream has 36 dB per octave roll off above 1.104 APSDd le-4Ã[ÀZv(1:nmind-1) Uv(nmind: 256)];
APSDu 10^(À3.8)Ã[Zv(1:6) Uv(7:nmaxu) Zv(nmaxu 1:256)]; ANd (0.8e-5)ÃAPSDu.Ãf1pt5;
Sigd APSDd.ÃHsq;
AFd (0.8e-5)ÃtotlengÃSigd.Ãfsq;
AXTd ANd AFd le-15;
ANu (0.8e-5)ÃAPSDd.Ãf1pt5;
plot(f,Bd); ®gure(gcf); grid on; pause;
Rated .004Ãsum(Bd(nmind:255));
% Upstream
fup f(1:32);
Sigu Sig(1:32);
plot(fup,10Ãlog10(Sigu le-15)); ®gure(gcf); grid on; hold on;
if nI>0;
plot(fup,10Ãlog10(IXT(1:32)));
plot(f(10),10Ãlog10(IXT(10)),`mo’);
end;
if nH>0;
plot(fup,10Ãlog10(HXT(1:32))`c’);
plot(f(10),10Ãlog10(HXT(10)),`cx’);
end;
plot(fup,10Ãlog10(AWGN(1:32)),`g’);
plot(fup,10Ãlog10(AXTu(1:32)),`r’);
plot(f(10),10Ãlog10(AXTu(10)),`rÑ); pause; hold off;
Noiseu (nIÃIXT(1:32).^a nHÃHXT(1:32).^ a nAÃAXTu(1:32).^ a).^ 0.6 AWGN(1:32); B min(log2(1 alphaÃSigu./Noiseu),BitCap(2));
Bu round((B>0.5).ÃB); % Minimum of one bit per with g 1.5 dB;
plot(fup,Bu); ®gure(gcf); grid on; pause;
Rateu .004Ãsum(Bu(8:nmaxu));
Sigu APSDu.ÃHsq;
AFu (0.8e-5)ÃtotlengÃSigu.Ãfsq;
AXTu ANu AFu 1e-15;
% Signals, noise and capacity;
a 1/0.6;
AWGN UvÃ10^(À13.5);
% Downstream
plot(f,10Ãlog10(Sigd le-15)); ®gure(gcf); grid on; hold on; if nI>0
plot(f,10Ãlog10(IXT),`m’);
plot(f(50),10Ãlog10(IXT(50)),`mo’);
end
if nH>0;
plot(f,10Ãlog10(HXT),`c’);
plot(f(50),10Ãlog10(HXT(50)),`cx’);
end;
plot(f,10Ãlog10(AWGN),`g’);
plot(f,10Ãlog10(AXTd),`r’); pause;
plot(f(50),10Ãlog10(AXTd(50)),`rÑ); pause; hold off;
Noised (nIÃIXT.^a nHÃ(HXT).^a nAÃAXTd.^a).^0.6 AWGN; B min(log2(1 alphaÃSigd./Noised),BitCap(1));
Bd round((B>0.5).ÃB); % Minimum of one bit per with g 1.5 dB; Ratedownup [Rated Rateu]
Không có nhận xét nào:
Đăng nhận xét