Thứ Sáu, 30 tháng 8, 2013

Phu luc A.html

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