Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
CHAPTER 7
CONCLUSION
As an effort towards improving the performance of wireless networks, ATM
technology is incorporated with various quality enhancement protocols. The thesis
proposes four novel error control schemes for WATM networks to reduce CLR and
CDV. By proposing an effective call admission control scheme called Decentralised
CAC @CAC), the current work reduces end-to-end CTD as much as possible. This
results in the enhancement of the overall system quality of WATM networks.
The main results of this work are summasized below:
The performance analysis of Code combining ARQ reveals that the number of
retransmissions is reduced. It is also observed that shorter WATM cells reduce
CLR while employing retransmission. If retransmissions are not allowed, then
the use of standard cell can provide better performance. The performance of
Code combining ARQ is compared with Conventional A N . When conventional
ARQ is used, high throughput is obtained for shorter cell in a low SNR (< 6 dB)
environment. When Code combinirzg ARQ is used, there is only a little
difference in throughput for different cell lengths. On the other hand, in a large
S N R (> 6 dB) environment, both ARQ methods exhibit almost the same
throughput. The conclusion here is that Code combining ARQ is a preferable
technique due to its simplicity and robustness under fluctuating channel
conditions.
As an error control scheme, Code combining technique may not work efficiently
in a channel where there are bursty errors. Concatenated Early-Stop ARQ
scheme which is proposed in the second phase af the work performs well against
bursty errors. The throughput efficiency of the Early-Stop PLRQ protocol is
analyzed for different values of m and k, The analysis is also cam& out with and
without delay constraints. The simulation results have shown that the
Concatenated Early-Stop ARQ scheme can reduce the probability of cell
retransmission and maintain a higher throughput over a wider range of channel
error rates. While comparing with and without Early-Stop ARQ, it is infenred
that the throughput with Early-Stop ARQ is 49% higher than that of without
Early-Stop ARQ. Different forward error correction schemes such as Code
combining scheme, Convolutional coding, RS coding and Concatenated coding
are analyzed based on their bit error probability. From the results, it is found that
Concatenated Early-Stop ARQ is efficient among other forward error correction
schemes.
Early-Stop ARQ performs well in a noisy environment but it needs more
bandwidth allocation initially for sending redundant information, To overcome
this limitation, Rate Compatible Punctured Convolution (RCPC) codes can be
employed. Punctured convolution coding is an antactive idea since it could
dynamicaIly vary the coding rate, adapting to changing channel characteristics.
The performance analysis of RCPC codes and UEP are carried out and
simulation results are presented. For better throughput, the tixne-insensitive
services require HARQ scheme with longer packets while the time-sensitive
services use shorter packets. The RCPC coding scheme provides varying
retransmission packet size and code rate according to the channel condition and
improves the throughput efficiency. A tTEP code scheme using PCCs is found
suitable for WATM in which the cell header is protected by a relatively powerful
PCC to ensure correct delivery. Fox multimedia transmission, different source
data require different levels of error protection, UEP schemes are therefore
suitable for such applications.
To enhance reliability in WATM networks, many channel coding schemes such
as Code combining ARQ, -1y-Stop ARQ and RCPC codes have been used, To
get a better performance, Turbo coding is employed. The Turbo coded e m r
control mechanism using one bit quantized extrinsic information for WATM
networks has been presented. From the resuIts, it is confirmed that Turbo coding
provides considerable coding gains as well as better BER in the error prone
environment. From the simulation results, it is shown that BER of more than lu5
is achieved at an SNlR of 5 dl3 for the Quantized Turbo coding. With the
proposed Quantized Turbo scheme, memory requirements of Turbo decoders are
greatly reduced. The results confirm that the nonsystmatic Turbo coding
provides better BER in the error prone environment compared to other
techniques including systematic Turbo coding. It is amazing to obtain lo-' BER
at a very small SNR of (2.5 - 3) dE3 which is almost approaches wire line BER
performance in Nonsystematic Turbo codes. It can be concluded that Turbo
coding is a very promising technique to effectively control channel emrs for
wireless ATM networks under any situation.
* A combined hybrid ARQ error-control and scheduling scheme is presented for
wireless ATM networks. Instead of treating the error recovery and scheduling
scheme in separate DLC and MAC layers, the scheduling scheme is implemented
in conjunction with a retransmission scheme. With the aid of proper channel
modeling, type I1 hybrid ARQ is chosen as the error recovery scheme to combat
fading effects, while adaptive fairqueuing is used as the scheduling scheme to
achieve a fari. and efficient resource allocation. Simulation results show that the
proposed scheme can achieve a high throughput with minhnum delay and cell
loss rate.
The proposed Retransmission algorithms based on power priorities may be used
for the power control of retransmitted WATM cells. The: pedormance of an
RAW has been analysed and the simulation result shows that the throughput
achieved is greater in this scheme,
Simulation results illustrate a considerable improvement in the call admission
control and in the overall network performance of the proposed decentralised
CAC. A comparative analysis of decenrralised GAC with centralised CAC for
different measures, such as admission delays and throughput has been camed
out. It is concluded that the proposed DCAC scheme perfonns better than
centralised CAC.
The program codes used to obtain the results available in this thesis are enclosed in
Appendix A.
The investigations carried out in this work provide ample scope for doing hrther
research with regard to the following aspects:
The current work uses Coherent QPSK system as modulation technique. Higher
level modulation techniques like MSK, 4 -QAM, and 16-QAM schemes can also
be implemented for WATM.
As the current work shows good error performance for Turbo codes, Irregular
Turbo codes and Asymmetric Turbo codes may also be tried for better error
control.
The proposed QoS enhancement protocols may be tried in other wireless
networks like Adhoc networks, TCP/IP based networks, CDMA networks etc.
The proposed MAC protacols work on TDMA/TDD systems. These techniques
can be extended to other access techniques like CDMAIFDD, CDMA/TDD,
CDMAIOFDM, WCDMA etc.
The present work considers AWGN and Rayleigh fading channels only. Further
research can use other wireless channels like Ricean channel, Gilbert-Elliot
channel, etc.
APPENDIX A
Ilimulation Programs of Code Combining ARQ
I* Code Combining *I typedef struct bits
unsigned bits1 : 1 ; unsigned bits2 : 1; unsigned bits3 : 1; unsigned bits4 : 1 ; unsigned bits5 : 1; unsigned bits6 : 1 ; unsigned bits7 : 1; unsigned bits8 : 1; unsigned bits9 : 1; unsigned bits 10: 1 ;
)BITS;
BITS Strb, EnData;
void Decoder( BITS EnData, BITS Strb );
void Encoder( long int iData)
int icounter; long int iTempData; iTempData = iData;
Strb.bitsl0 iTempData Strb.bits9 iTempData Strb.bits8 iTempData Strb.bits7 iTempData Strb.bits6 iTempData Strb.bits5 iTempData Strb.bits4 iTempData Strb.bits3 iTempData Strb.bits2
= iTempData % 10; = iTempData.4 0; = iTempData % 10; = iTempDatdl0; = iTempData % 10; = iTempDatdl0; = iTempData % 10; = iTernpDatdl0; = iTempData % 10; = iTempDatall0; = iTempData % 10; = iTempDatdl0; = iTempData % 10; = iTempDataIl0; = iTempData % 10; = iTempData/ 1 0; = iTempData % 10;
/*Initial Data Display */ printf("\t\tCODE COMBINER\tV); printf("\n\t ****"********\t")- 3
printf("\nTransmitted Data:\tW); printf("l%ul',Strb.bitsl); printf("%u",Strb.bits2); printf("%uV,Strb.bits3); printf("%uW,Strb.bits4); printf("%u",Strb.bits5); printf("%u",Strb.bits6); printf("%u1',Strb.bits7); printf("%~"~Strb.bits8); printf("%u",Strb.bits9); printf("%ul\n",Strb.bitslO);
/* Encoded Data Display */ printf("\nEncoded Data:\t\tl'); printf("I%u",EnData.bits 1); printf("%u",EnData,bits2); printf("%u",EnData.bits3); printf("%u",EnData.bits4); printf(11%u",EnData.bits5); p~tf("%u",EnData.bits6); printf("%u",EnData.bits7); printf("%u",EnData.bits8); phtf("%u",EnData.bits9); printf("%uIW1,EnData.bits 10); Decoder( EEnData,Strb);
clc; format long nci = [ l 5 1 1 130305 22108415 28077687051; nci I = nci; foru= 1:1:3
pac l = 0; c = 1; nhecawgn = [f; g = 0; v = 0; s = o ; b = [I; tavg = [I; i f u - 1
k = 120; m = 40; n = 7 ;
elseif u - 2 k = 150; m = 100; n = 7;
elseif u == 3 k = 160; rn = 60; n = 7;
end for j = .0001:.0001:. 1
f = 0; for i = 0:1:4
pac(i+l) = nci(i+l) * (6) A i) * ((1 - j) A (5 11 - i)); pacl = pac(i4-I) + pacl;
end f m j =m:l:k
if (n- 1 > < (k-j) z = (n-1);
else z = (k-j);
end v = (factoria16- I )/((factorid(m- 1) * (factorial((j- 1)-(m- I)))))); g=pacl Am; s = (I-pacl) A 6-m); bQ)= z * v * g * s ; f = f + bfj);
end tavg = (rnlpac 1) t- fi nhecawgn(c) = (rn/tavg) * (443/5 1 1);
pac l = 0; c = c + l ;
end for x = 1:1:2
pac11 = 0; k l = 1; if x == 1
nl = 1; elseif x -2
nl = 7; end forj = .0001:.0001:.1
for i = 0: 1 :4 pacl(i+l) = ncil(i4-1) * ((j) A i) * ((I - J) A (5 1 1 - i)); pac11 = pacI(ii-1) + pacl I;
end ngbn(k1) = (pacl ll(pacl1 + (nl * (1 - pacll))) * (443151 1)); %disp(ngbn); pacll = 0; kl = kl + 1;
end i fx - 1
ngbn 1 = ngbn; elseif x = 2
ngbn7 = ngbn; end
end i f u = 1
nhecawgnl = nhecawgn; elseif u = 2
nhecawgri! = nhecawgn; efseif u = 3
nhecawgn3 = nhecawgn; end
end ber = .0001:.0001:.1; semilogx(ber,ngbnl ,':',ber,ngbn7,':',ber,nhecawgnl ,ber,nhecawgd,ber,nhecawgn3); axis([.0001 - 1 0 11); xlabelllBit enor rate'); ylabel(Throughput efficiency'); %grid on;
Simulation Programs of Concatenated Early-Stop ARQ
clc; format Iong nci = / 1 5 1 1 130305 22 1084 15 28077687051; nci 1 = nci; for u = 1:1:3
pac 1 = 0; c = 1; nhecawgn = [I; g = 0; v=o ; s = 0; b = [I; tavg = [I; i f u = 1
k = 150; m = 100; n=7;
elseif u = 2 k = 120; m = 60; n = 7;
elseif u -= 3 k = 120; m = 40; n = 7 ;
end for j = .0001:~0001:.1
f = 0; for i = 0:1:4
pac(i+l) = nci(i+l) * (6 ) * i) * ((1 - j) A (51 1 - i)); pacl = pac(i+l) -t pacl ;
end forj = m:I:k
if (11-11 < (k-j) z = (n-1);
else z = (k-j);
end v = (factorial@-l)/((factorial(m-1) * (factorial((j-1)-(m-1)))))); g = pacl A in; s = (1 -pacl) A 6-m); bu)= z * v * g * s ; f = f + b(j);
end
tavg = (m/pacl) + f; nhecawgn(c) = (dtavg) * (443/5 1 1); pacI = 0; c = c + l ;
end for x = 1:1:2
pac 1 1 = 0; k l = 1; i f x == 1
nl = 1; elseif x ==2
n l = 7; end for j = .0001:.0001:.1
for i = 0:1:4 pacl(i+l)=ncil(i+l) * (( j)Ai) * ((1 -j)*(511 - i)); pac11 = pacl(i+l) + pac11;
end ngbn(k1) = b a c l ll/acll + (nl * (1 - pacll))) * (443151 I)); %disp(ngbn); pac 1 1 = 0; k l = kl t- 1;
end i f x = 1
ngbnl = ngbn; elseif x = 2
ngbn7 = ngbn; end
end if u == 1
nhecawgnl= nhecawgn; elseif u = 2
nhecawgn2 = nhecawgn; elseif u = 3
nhecawgn3 = nhecawgn; end
end ber = .0001:.0001:.1; semilogx(ber,ngbn 1 ,':',ber,ngbn7,':',ber,nhecawgnl ,ber,nhecawgn2,ber,nhecaw~3); axis([.0001 . I 0 13); xlabel('Bit error rate'); ylabei(Throughput efficiency'); %grid on;
clc; p = 10; x i = [I; y2 = [I; x2 = [I; y2 = [I; x3 = [I; y3 = [I; x4 = [I; ~4 = El; x5 = [I; y5 = [I; %x6 = [I; %y6 = [I; Tors= 1:1:5
ifs== 1 m = 9 ; k = 10;
elseif s == 2 m = 45; k = 50;
elseif s == 3 m = 1; k = 1;
elseif s == 4 rn = 95; k = 100;
elseif s == 5 m = 100; k = 120;
end p = 10;
forr = 1:1:9 p = p110; ifp- 1
p m k = l ; else forj = 0:l:m-1
pmk = (factorial(k)/(factorialCj) * factorial(k - j)) * (1 - p) A j) * p A (k - j); end
end %disp(pmk); %disp(p); i f s= 1 x 1 (r) = p; y 1 (r) = pmk;
elseif s == 2 x2(r) = p; y2(r) = p d ;
elseif s == 3 x3(r) = p; y3(r) = p d ;
elseif s == 4 x4(r) = p; y4(r) = pmk;
eiseif s == 5 x5(rj = p; y5(r) = pmk;
end end %disp(y); %format long %disp(x); %disp(y); ioglog(x 1 ,y 1 ,x2,y2,x3,y3,x4,y4,x5,y5); xlabel('cel1-loss probability p'); ylabel('cel1-unrecovered probability p(m,k)'); %title(lprobability of decoding failure versus cell-error probability'); axis([le-8 1 le-12 11); legend('m=9 k= 10','m=45 k5Of,'rn= 1 k= l','m=95 k= 1 00','m= 100 k==120',2); end
clc; m = 45; k = 50; p = 10; %x = [I; %y = [I; f a r r= 1:1:9
p =p/iO; i f p = 1
pmk= 1; else forj = 0:l:m-1
prnk = (factorial(k)/(factorial(j) * factorial(k - j)) * (1 - p) A j) * p A (k - j); end end disp(pmk); dispb) ; x(r) = p;
y(r) = p d ; end %disp(y); %format long %disp(x); %disp(y); loglog(x,~); %axis([lOe-7 1 10e-12 11); grid on;
clc; format long nci = [ l 51 1 130305 22108415 28077687051; nci I = nci; foru = 1:1:3
pacl = 0; c = 1; nhecawgn = [I; g = o ; v = o ; s=o; b = [I; tavg = [I; i fu == 1
k = 120; m = 40; n = 1370;
elseif u = 2 k = 150; m = 100; n = 1370;
elseif u == 3 k = 120; m = 60; n = 1370;
end for j = -0001 :.0001:.1
f=O; for i = 0:1:4
pac(i+l) = nci(i-t.1) * (6) A i) * ((I - j) A (5 1 1 - i)); pacl = pac(i+l) + pacl;
end forj = m:l:k
if (n- 1) < (k-j) z = (n-1);
else
z = (k-j); end v = (factorial& l)/((factorial(m- 1 ) * (factorial(& 1 )-(m- 1 I))))); g = pacl Am; s = (I-pacl) A (j-m); b(j)= z * v * g * s ; f = f -t b(j);
end tavg = ( d p a c 1) + f; nhecawgn(c) = (m/tavg) * (443/5 1 1); pacl = 0; c = c + l ;
end for x = 1:1:2
pacl 1 = 0; k l = 1; i fx= 1
nl = 1; elseif x ==2
nl = 7; end forj = .0001:.0001:.1
for i = 0:1:4 pacl(i+l)= ncil(i+l) *(G) "i) * ( ( I - j) A (511 - i)); pacl 1 = pacl(i+l) + pac11;
end ngbn(k1) = @acl l/(pacll -I- (nl * (1 - pacl 1))) * (443511 1)); %disp(ngbn); pacll = 0; kl = kl -t 1;
end i f x = 1
ngbn 1 = ngbn; elseif x - 2
ngbn7 = ngbn; end
end if u == 1
nhacawgnl = nhecawgn; elseif u = 2
nhecawgn2 = nhecawgn; elseif u = 3
nhecawgn3 = nhecawgn; end
end her = .0001:.0001:,1;
sernilo~(ber,ngbn 1 ,':',ber,ngbn7,':?ber,nhecawgn I ,ber,nhecaw@,ber,nhecawgd); axis([.0001 .1 0 I]); xlabel('B1T ERROR RATE'); ylabel('THR0UGHPUT EFFICIENCY'); %grid on;
clc; p = 10; xl = [I; y2 = [I; x2 = [I; ~2 = El; x3 = [I; ~3 = [I; x4 = [I; ~4 = [I; x5 = [I; Y5 = [I; x6 = [I; ~6 = 11; for s = 1:1:6
i f s== 1 m = 9; k = 10;
elseif s == 2 m = 45; k = 50;
elseif s = 3 m = 1; k = 1;
elseif s == 4 rn = 95; k = 100;
elseif s = 5 m = 100; k= 120;
elseif s == 6 m = 100; k = 100;
end p = 10;
forr= 1:1:9 p = pll0; i fp= 1
pmk = 1;
else for j = 0:l:m-1
pmk = (factorial(k)/(factorial(j) * factorial(k - j)) * ( 1 - p) A j) * p A (k - j); end
end %disp@mk); %disp(p); i fs- 1
xl(r) = p; y 1 (r) = pmk;
elseif s == 2 x2(r) = p; y2(r) = pmk;
elseif s == 3 x3(r) = p; y3(r) = p d ;
elseif s == 4 x4(r) = p; y4(r) = pmk;
elseif s == 5 x5(r) = p; y5(r) = pmk;
elseif s == 6 x6(r) = p; YW = P&,
end end %disp( y); %fomat long %di sp(x); %disp(y); %axis([l Oe-7 1 10e- 12 11); ~oglog(x1 ,yl ,x2,y2,~3,y3,~4,~4,x5,y~,x6,1; axis([le-8 1 le-12 11); xlabel('ceI1-loss probability p'); ylabel('cel1-unrecovered probability p(m, k)'); title('probabi1ity of decoding failure versus cell-error probability'); %grid on; %legend('m=g k= 1 Ot,'m=45 k=50','m= 1 k=1 ','m=95 k=1 OO','m=100 k 120','m=I 00 k=1 O0',4); End ,
clc; n = 2024; format long x = [I;
e = -001; for i = 1:1:6
i f i - I x(i) = e;
else x(i} = x(i- l)/l 0;
end end disp(x); pu = [I; qu = [I; forif 1:1:6
pu(i) = ( 1 - x(i)) " 2024; qu(i) = ( I - pu(i));
end dispbu); disp(qu); pd = pu; qd = qu; for i = 1:1:6
m(i) = pu(i) * pd(i); b(i) = pd(i) * qu(i); k(i) = (pd(i) * qu(i)) A 2; j(i) = pu(i) * qu(i) * pd(i) * qd(i); g(i) = ((k(i) + j(i) + k(i))/(b(i) + b(i)) * 64); n(i) = (m(i)/(m(i)+g(i)));
end disp(n); serniIogx(x,n); xlabel('BIT ERROR RATE'); YLABEL('THR0UGHPUT'); %grid on;
clc; n = 2024; format long x = 0 ; e = .01; fori = 1:1:7
i f i - 1 x(i) = e;
else x(i) = x(i-l)/lO;
end
end disp(x); pu = tl; pd = 11; for i = 1:1:7
pu(i) = ( 1 - x(i)) A 2024; end disp(pu); pd = pu;
= 11; I- = [I; nc = [I; fori = 1:1:7
m(i) = pu(i)"2; r(i) = m(i) t- (1 - m(i)) * 128; nc(i) = m(i)/r(i);
end disp(nc); %semilogx(x,nc); for i = 1:1:7
j(i) = pu(i) * (pu(i) A 10); k(i) = j(i) + ( I - j(i)) * 128; nc 1 O(i) = j(i)/k[i);
end semiIogx(x,nc,x,nc 1 0); grid on;
Simulation Programs of RCPC coding
Pb = [I; sopt = [I; for x =1:100000
tempPb = 1 /(2*x); te~npSopt = 16 * (sqrt(3 -(. 125/log(l -tempPb)))- I); Sopt = [Sopt tempsopt]; Pb = [Pb tempPb];
end semi10gx(?b,Sopt7'm1j; xlabel('Channe1 BER'); ylabel('Blocksize(Bits)');
clc; tempa = 1; tempc =I ; throav = [I; PC = [I; ber = (];b6=[]; throu-arq = [I; berl = [I; PC = 0; Pb = 0; k=[l 2 3 4 51; l(k) = [ l 2 4 8 161;
d l =[3 4 5 6 7 81; Cdl = [24 740 13321 217761 33 15491 482781771;
for x = 1:5000, X
pb = 1/(2*x);
berl = [ber? pb];
prd = I-( 1 8 4 ; -pb)"3
lav 1 = 460/(1 -prd);
tav 1 = 384/lav 1 ;
throu-arq = 1 ) ; [thou-arq tav
tempa = pc(l)*pc(2)*pc(3)*pc(4)*pc(5);
a = 16 * tempa; a bl = 0; b2 = 0; b3 = 0; b4 = 0; b5 = 0;
for k=1:5,
elseif k == 3
else
end end
tav = 7.3/(8+lav);
throav = [throav tav 1;
ber = [ber pb];
end
semilogx (ber, throav,'b-.',berl ,throu-arq,'mf); xlabel('BERf); ylabel('THROUGHPUTf); legend('Hybrid ARQ(RCPC)','ARQf) title('Cornparison of throughput of Hybrid ARQ with Simple ARQ Technique for Block size 3 84 bitsf);
output 1 = ClossR(d 1 ,Cdl ,totalR(l));
ber 1 = output 1 (1 ,:); cIrl = output1 (2,:);
logIog(ber1 ,clrl , ' b - - ' , b e r 2 , c l r 2 , ' g * ' , b e r 3 , c k 3 , ' r . ' , b ~ ' ) ; legend('8/24','8/16','8/ 12','8/1 01,'8/91; xlabel('l3ER'); y1abel('CLR1); title('Accepted CLR with 5 rates for block size 48 bits');
hnction out - throughput(d,Cd,pb) PC = 0;
for i=1:6 Pd = 0.5 * (pb)"d(i);
tempPc = Pd * Cd(i); pc = pc t tempPc;
end tempBer = pc/8; pc = I - ( I - tempBer)/\384; out = pc;
function out = ClossR(d,Cd,R)
Clr = [I; Ber = [I; PC = 0; for x= 1 : 10000
Pb = 1/(2*x); for i=1:1:6
Pd = 0.5 * (PbIAd(i); tempPc = Pd * Cd(i); PC = PC I- tempPc;
end tempBer = Pc/8; tempClr = 1 - (1 - tempBer)"48; Clr = [Clr tempClr]; Ber = [Ber Pb]; PC = 0;
end out = [Ber ; Clr]; Ber Clr
dl = [ I 4 15 16 17 18 191; Cdl = [8 0 160 0 424 01;
output 1 = ClossR(d 1 ,Cdl,totalR(l));
berl = outputl(1,:); clrl = output 1 (2,:);
loglog(ber 1 ,clr 1 ,%--',ber2,clr2,'gw,ber3,clr3,'r.',ber4,c~4,'c+t,ber5,clr5,'mt); legend('8/24','8/16','8/ 12','8/10','8/9'); xlabel('BER'); ylabel('CLR'); title('Accepted CLR with 5 rates for block size 48 bits');
Simulation Programs of Turbo Coding
clc; clear all; clear all; % Choose decoding algorithm fprintf('\n O=SOVA \n 1 =logemap'); dec-aIg = input('\n choose the decoding aIgorithm from the choiser); if isempt y(dec-alg)
dec-alg = 0; end
totallength = input('Enter the Size of the ATM packets'); if isempty(total1ength)
totallength = 56; end
g = [ 1 1 1;l 0 11; [n,K] = size(g); m = K - 1; nstates = 2"m;
puncture = input(' Please choose punctured / unpunctured (0/1): default 0 '1; if isempt puncture)
puncture = 0; end
rate = 1 /(2+puncture);
niter = input(7n Enter number of iterations I); if isempty(niter)
niter = 10; end
% Number of frame errors to stop criterior ferrlirn = input('h Enter the number of frames in errors to terminate '); if isempty(ferr1im)
ferrlim = 3; end
%% For get the signal to noise ratio values ~bNOdb = input(' \n Enter the the SNR (Eb/NO) in d~ l);
if isempty(EbN0db) EbNOdb = [5.0];
end
for i = 1:n for j = 1:K
fprintf( '%6d', g(i j)); end fpIintf('W);
end
for i = 1 :length(EbNOdb) @rintf('% 10.2f ,EbNOdb(i));
end
% convert signal to noise ratio from dB to the normal value for nEN = l:length(EbNOdb)
normal = (EbNOdb(nEN)/ 1 0); en = 1 OA(normal) L-c = 4*s*en*rate; sigma = l/sqrt(2*rate*en);
% Clear bit error counter and frame error counter errs(nEN, I :niter) = zeros(1 ,niter); nferr(nEN, 1 :niter) - zeros(1 ,niter);
nframe = 0; % clear counter of transmitted frames while nferr(nEN, niter)<ferrlim
nfiame = nfxarne + 1 ; x = round(rand(1, totallength-m)); % info. bits [temp, alpha] = sort(rand(1 ,totallength)); % random interleaver mapping en-output = en-coder( x, g, alpha, puncture ) ; % encoder output (+I/- I)
r = en~output+sigma*randn(l,totallengtlP(2+pcre)); % received bits yk = demux(r,alpha,puncture); % demux to get input far decoder 1 and 2
% Initialize extrinsic information L-e(l :totallength) = zeros(1 ,totallength);
for iter = 1 :niter
% Decoder one L_a(alpha) = L-e; % a priori info. if dec-alg -- 0
L-all= logmapo(rec-s(l,:), g, L-a, I); % complete info. else
L-all= sova-algo(rec-s(l,:), g, L-a, 1); % complete info. end
L-e = L-all - 2*rec-s(lyl:2:2*totallength) - L-a; % extrinsic info.
% Decoder two L-a = L-e(a1pha); % a priori info. if dec-alg = 0
L-all= logrnapo(rec-~(2,:)~ g, L-a, 2); % complete info. else
L-all= sova-algo(rec-~(2,:)~ g, L-a, 2); % complete info. end L-e = L-all - 2*rec-s(2,1:2:2*totallength) - L-a; % extrinsic info.
% Estimate the info. bits xhat(a1pha) = (sign(L-all)+ 1)M;
% Number of bit errors in current iteration
% Count fi-arne errors for the current iteration if err(iter)> 10
nferr(nEN,iter) = nferr(nEN,iter)+ 1 ; end
end
% Total number of bit errors for all iterations errs(nEN, 1 :niter) = errs(nEN,l :niter) + err(1 :niter);
if rern(nfi-ame,3)==0 I nferr(nEN, niter)=fedim % Bit error rate
ber(nEN, 1 :niter) = errs(nEN, 1 :niter)/nframe/(totallength-m); % Frame error rate
fer(nEN, 1 :niter) = nferr(nEN, 1 :niter)/nfrme;
% Display intermediate results in process @rintf('**"*"******** Eb/NO = %5.2f db **************\n' EbNOdb(nEN))- fprintf('Frame size = %d, rate 1/%d. W, totallength, 2+puncture); fprintf('%d frames transmitted, %d frames in error.\nl, nframe, nferr(nEn, niter));
fprintf('Bit Error Rate (fi-om iteration 1 to iteration %d):\nt, niter); for i=l:niter
@rintf('%8,4e ', ber(nEN,i)); end fprintf('\nf); f+printf('Frarne Error Rate (from iteration 1 to iteration %d):\nf, niter); for i= 1 :niter
fprintf('%8.4e ', fer(nEN,i)); end fprintf('\n '); fpr&f('*********' 1;
end end
end
Eunction en-output = en-coder( x, g, alpha, puncture ) [n,K] = size(g); m = ( K ) - 1; L-info = length(x); totallength = L-info + m; % For the 1 st RSC coder, generating corresponding codeword input = x; output 1 = RSC(g,input, 1); y(1,:) = outputl (1 :2:2*totallength); y(2,:) = outputl (2:2:2*totallength); % interleaver input to second encoder for i = 1 :totallength
input1 (1 ,i) = y( 1 ,alpha@)); end output2 = RSC(g, input l(1,l :totallength), -1 ); y(3,:) = output2(2:2:2*totallength);
if puncture > 0 for i = 1 :L_total
forj = 1:3 en_output(l,3 *(i-l)+j) = y(j,i);
end end
else for i= 1 :totallength
m-output(1 ,n*(i- 1)+ 1) = y( 1 ,i); if rem(i,2) % odd check bits from RSC1
en-output(1 ,n*i) = y(2,i);
eIse % even check bits from RSC2
en-output(1 ,n*i) = y(3,i); end
end end
en-output = 2 * en-output - ones(size(en-output));
clc; clear all; t=cputime;
for sn1==0:5 hata(snr+ l)=O;
for j=l :carpan(snr+l) n= 100; u=randint(l ,n-2); u(n)=O; kafes=poly2trellis(3 ,[5 73); v=convenc(u,kafes); for i=1:2*n
s(i)=2*v(i)- 1 ; end r = awgn(s,snr,'measured');
x l l 1=-1;xl12=-1;x121=1;x122=1; x23 1 =- 1 ;x232=1;x241=1 ;x242=-1; x311=1;x312=1;x321=-l;x322=-1; x43 1 = 1 ;x432=-1 ;x441=- 1 ;x442=1;
k=O; Eb=2;NO=~b/(l OA(snr/l O));sigma=NO/2; for i=1:2:2*n
k=k-t- 1 ; gama 1 1 (k)=exp((-(r(i)-x 1 1 1)"Z-(r(i4- 1 )-x 1 1 2)A2)/2/sigrma); gama 12(k)=exp((-(r(i)-x 12 1 )"2-(r(i+l )-x 122)"2)/2/sigma); gama23(k)=exp((-(r(i)-x23 1 )"2-(r(i+ 1)-x232)"2)/2/sigma);
gama24(k)=exp((-(r(i)-x24 1 )"2-(r(i+ 1)-x242)/'2)/2/sigma); gama3 1 (k)=exp((-(r(i)-x3 t I)"2-(r(i+l)-x3 12)"2)/2/siglna); gama32(k)=exp((-(r(i)-x321)"2-(r(i+1)-~322)*2)/2/si~a); gama43(k)=exp((-(r(i)-x43 1)A2-(r(i+1)-x432)A2)/2!sigma); gama44(k)=exp((-(r(i j-x44 1 )"2-(r(i+ 1)-x442)*2)/2!sigma);
end
alfal (l)=gamal 1 (l);affa2(1)=gamal2(1);alfa3(l)=O;alfa4(1)=0; for i=2:n
alfa 1 (i)=alfal (i- 1 )*gama 1 1 (i)+alfa3(i- 1 j*garna3 1 (i); alfa2(i)=alfal (i- 1 )*gama lZ(i)+alfa3(i- l)*gama32(i); alfa3 (i)=alfaZ(i- 1 ) *gama23 (i)+alfa4(i- 1 )*gama43(i); alfa4(i)=alfa2(i- 1 )*gama24(i)+alfa4(i- 1 )*gama44(i);
end
betal (n-l)=gamal 1 (n);beta3(n-l)=gama3 l(n);beta2(n- l)=O;beta4(n- 1)=0; for i=n-2:- 1 : 1
betal (i)=betal (i-t l)*gainal l(i+l)+beta2(i+l)*gama12(i+l); beta2(i)=beta3(i+ l)*gama23(i+l )+beta4(i+l)*gama24(i+ 1); beta3(i)=betal (ii- l)*gama3 l(i+l)+beta2(i+l)*gama32(i+l); beta4(i)=beta3(i+ l)*gama43(i+l)+beta4(i+l)*gama44(i+l);
end
for i=2:n-2 pay=(alfal (i- l)*gamal I(i)*betal (i)+alfa2(i-l)*gama23(i)"beta3(i)+ ...
alfa3(i- l)*gama3 1 (i)*beta 1 (i)+alfa4(i-l)*garna43(i)*beta3 (i)); payda=(alfal (i- l)*gamal2(i)*beta2(i)+alfa2(i- l)*gama24(i)*beta4(i)+-..
alfa3(i- l)*gama32(i)*beta2(i)+alfa4(i- l)*gama44(i)*beta4(i)); L-a(i)=log(pay/payda);
end for i= 1 :n-2
if L-a(i)>O a(i)=O;
else a(;>= 1 ;
end end a(n)=O; hata(snr+ 1 )=hata(snr+ 1 )+sum(abs(u-a));
end hata(snr+ 1); bit-hata-orani(snr+l )=hata(snr+l)/100/carpan(~nr+ I )
end snr=O: 5:25; semilogy(snr,bit-hata-orani), title('MAP1);x1abel('Eb/NO(dB)');ylabel('Bit Error Rate'); zaman=cputime- t
function L-all= sova(rec-s, g, L-a, ind-dec)
totallength = length(L-a); [n,K] = size(g); m = K - 1; nstates = 2"rn; Lifty = 1 el 0;
delta = 30;
% Set up the trellis defined by g. [next-out, next-state, last-out, last-state] = trellis(g);
% Initialize path metrics to -1nfiy for t==l :totallength+l
for state=l :nstates path-rnetric(state,t) = -hfty;
end end
% Trace forward to compute all the path metrics path-metric(1,l) = 0; for t= 1 :totallength
y = rec-s(2*t-l:2*t); for state=l :nstates
symO = last-out(state, 1 :2); syrnl = last_out(state,3:4); state0 = last-state(state, 1); state1 = last_state(state,2); MkO = y*symOf - L_a(t)/2 t path-metric(state0,t); Mkl = yXsyml' + L_a(t)/2 + path_metric(statel ,t);
if MkOsMk1 path-metric(state,t+l )=MkO; Mdiff(state,t+ 1) = MkO - Mkl ; prev-bit(state, t+l) = 0;
else path-metric(state,t+ l)=Mkl ; Mdiff(state,t+l) = Mkl - MkO; prev-bit(state,t+l) = 1 ;
end
end end
% For decoder 1, trace back from all zero state, & for decoder two, trace back from the most likely state if ind-dec == 1
mlstate(totallength+l) = 1 ; else
mlstate(totallength+ 1) = find( pathmetric(: ,totallength+l)==max(path~metrie(:,totalltength+ 1)) ); end
% Trace back to get the estimated bits, and the most likely path for t=totallength:-1 : 1
est(t) = prev-bit(mlstate(t+l),t+l); mlstate(t) = last-state(mlstate(t+l), est(t)+l);
end
% Find the minimum delta that corresponds to a compitition path with different info. bit estimation. & Give the soft output for t=l :totallength
Ilr = Infty; for i=O:delta
if t-ti<totallength+l bit = 1 -est(t+i); temp-state = last-state(mlstate(t+i+l), bit+l); for j=i-1 :-1:0
bit = prev-bit(temp-state,t+j+l); temp-state = last-state(temp-state, bit+l);
end if bit-=est(t)
llr = min( lk,Mdiff(mlstate(t+i+l), t+i+l) ); end
end end L-all(t) = (2*est(t) - 1) * llr;
end
function L-all= logmapo(rec-s,g,L-a,ind_dec)
L-total = length(rec-s)/2; [n,K] = size(g); m = K - I ; nstates = 2"m;
% Set up the trellis [next-out, next-state, last-out, last-state] = treIlis(g); Infty = le10;
% Initialization of Alpha Alpha(1, I ) = 0; Alpha( 1,2:nstates) = -Lnfty*ones(l ,nstates- 1);
% Initialization of Beta if ind-dec== 1
Beta(L-total, 1) = 0; Beta(L-total,2:nstates) = -Infiy*ones(l ,nstates-1);
elseif ind-dec==2 Beta(L-total, 1 :nstates) = zeros(1 ,nstates);
else @rintf('ind-dec is limited to 1 and 2!\n');
end
% Trace forward, compute Alpha for k = 2:L_total+ 1
for state2 = 1 :nstates gamma = -hfty*ones(l ,nstates); garnma(1ast-state(stat e2, I)) = (-rec-s(2* k-3)+rec-s(2 *k-2)*1ast__out(state2,2)).. ..
-log( 1 +exp(L-a(k- 1))); gamma(1ast-state(state2,2)) = (rec-s(2*k-3)+rec-s(2*k-2)*last_out(state2,4)). . ..
+L-a(k- 1 )-log( 1 +exp(L-a(k- 1)));
if(sum(exp(gamma+Alpha(k- 1 ,:)))< 1 e-300) Alpha(k,state2)=-Infty;
else Alpha(k,state2) = log( sum( exp( gamma+Alpha(k-1,:) ) ) );
end end temprnax(k) = rnax(Alpha(k,:)); Alpha(k,:) = Alpha(k,:) - tempmax(k);
end
% Trace backward, compute Beta
for k = L-total- I :- 1 : 1 for state1 = 1:nstates
gamma = -Infty*ones( 1 ,nstates); gamma(next-state(statel,l)) = (-rec-s(2*k+ l)+rec-s(2 *k+2)*nextout(state 1,~)). ...
-log( 1 +exp(L-a(k+ 1 ))); gamma(next_state(statel,2)) = (rec-s(2*k+ l )+rec-s(2*k+2)*next_out(state l,4)) ....
+L-a(k+ 1 )-log( 1 +exp(L-a(k+ 1 ))); if(sum(exp(gamma+Beta(k+1,:)))< 1 e-300)
Beta(k,state I)=-Infty; else
Beta(k,state 1) = log(sum(exp(gamma+Beta(k+ 1 ,:)))); end
end Beta(k,:) = Beta(k,:) - tempmax(k+l);
end
% Compute the soft output, log-likelihood ratio of symbols in the frame for k = 1 :L-total for state2 = 1 :nstates
gamma0 = (-rec-s(2*k- l)+rec~~(2*k)*last~out(state2~2))~. .. -log( 1 +exp(L-a(k)));
gamma1 = (rec~s(2*k-l)+rec~s(2*k)*last~out(state2,4)) ... +L-a$)-log(l+exp(L-a(k)));
tempO(state2) = exp(gamma0 + Alpha(k,last_state(state2,1)) t- Beta(k,state2)); temp1 (state2) = exp(gamma1 3. Alpha(k,last_state(state2,2)) + Beta(k,state2));
end L-all(k) = log(sum(temp1)) - log(surn(temp0));
End
clc ; clear all; clear all; % Choose decoding algorithm fprintf('\n O=QSOVA 'm 1-Qrnap'); dec-alg = input('\n choose the decoding algorithm from the choise'); if isempty(dec-alg)
dec-alg = 0; end
% size of the ATM Frames totallength = input('Enter the Size of the ATM packets'); if isempty(total1ength)
totallength = 56; end
[n,K] = size(g); m = K - 1; nstates = 2"m;
puncture = input(' Please choose punctured 1 unpunctured (04): default 0 I);
if isempty(puncture) puncture = 0;
end
% Code rate rate = I /(2+punchlre);
% Number of iterations
niter = input('~1 Enter number of iterations I); if isempty(niter)
niter = 10; end
% Number of frame errors to stop criterior ferrlim = input('\n Enter the number of frames in errors to terminate I); if isempty(ferr1im)
ferrlim = 3; end %% For get the signal to noise ratio values EbNOdb = input(' \n Enter the the SNR (Eb/NO) in dB '1; if isempty(EbN0db)
EbNOdb = E5.01; end
for i = l:n for j = 1:K
Qrintf( '%6d1, g(i j)); end fprintf('\nl);
end
for i = 1 :length(EbNOdb) fprintf('% 1 0.2f ,EblOdb(i));
end
% convert signal to noise ratio from dB to the normal value for nEN = 1 :length(EbNOdb)
normal = (EbNOdb(nEN)/ 1 0); en = 1 OA(normal) L-c = 4*s*en*rate; sigma = l/sqrt(2*rate*en);
% Clear bit error counter and frame error counter errs(nEN, 1 :niter) = zeros(1 ,niter); nferr(nEN, 1 :niter) = zeros( 1 ,niter);
nframe = 0; while nferr(nEN, niter)<fenrlim
nframe = nframe + 1; x = round(rand(1, totallength-m)); [temp, alpha] = sort(rand(1 ,totallength)); en-output = en-coder( x, g, alpha, puncture ) ;
% Initialize extrinsic information L-e(1 :totallength) = zeros(1 ,totallength);
for iter = 1:niter
% Decoder one L-a(alpha) = L-e; % a priori info.
L-a 1 = quantiz(L-a(alpha),-4: 1 :3 ,-4A 5); % if dec-alg = 0
L-all= logmapo(rec-s(l,:), g, L-a, 1); % complete info. else
L-all= sova-algo(rec-s(l,:), g, L-a, 1); % complete info. end
L-e = L-all - 2*rec_s(l, 1 :2:2*totaIlength) - L-a; % extrinsic info.
% Decoder two L-a = L-e(a1pha); % a priori info.
L+a2= L-a .' ; % L-a2 = quantiz(L-a,-4: 1 :3,-4: 1 5); % if dec-alg = 0
L-all= logmapo(rec-s(2,:), g, L-a, 2); % complete info. else
L-all = sova-algo(rec-s(2,:), g, L-a, 2); % complete info. end L-e = L-all - 2*rec-s(2,1:2:2*totallength) - L-a; % extrinsic info.
% Estimate the info. bits
% Number of bit errors in current iteration
% Count frame errors for the current iteration if err(iter)> 10
nferr(nEN,iter) = nferr(nEiN,iter)+ 1 ; end
end
% Total number of bit errors for all iterations errs(nEN, 1 :niter) = errs(nEN, I :niter) + err(1 :niter);
if rem(nframe,3)==0 I nferr(nEN, niter)=ferrlim % Bit error rate
ber(nEN, 1 :niter) = errs(nEN, 1 :niter)/nframe/(totallength-m); % Frame error rate
fer(nEiN, 1 :niter) = nferr(nEN, 1 :niter)/nframe;
% Display intermediate results in process fpfintf('**********-Xd** Eb/NO = OA5+2f db **************hi, ]EbN&jb(nEN)); fprintf('Frame size = %d, rate l/%d. W, totallength, 2tpuncture); fprintf('0hd frames transmitted, %d frames in ermr.W, nframe, nferr(nEN, niter)); fhrintf('Bit Error Rate (fiom iteration 1 to iteration %d):\nt, niter); for i= 1 :niter
+rintf('%8.4e ', ber(nEN,i)); ' end
fbrintf('\nl); fprintf('Frame Error Rate (from iteration 1 to iteration %d):\n', niter); for i=l :niter
@rintf('%8.4e ', fer(nEN,i)); end fprintf('\nf); fpSntf(f*********t >;
end end
end
clc; clear all; t=cputime;
for snr=0:5 hata(snr+i )=0;
for j=l:carpan(snr+l) n= 100; u=randint( 141-2); u(n)=q kafes=poly2trellis(3,[5 73); v=convenc(u,kafes); for i=l:2*n
s(i)=2*v(i)- 1 ; end r = awgn(s,snl;'measuredl);
k=O ; Eb=2;NO=Eb/(l OA(snr/ 1 O));sigma=N0/2; for i=1:2r2*n
k=k+ 1 ; gama 1 1 (k)=exp((-(r(i)-x 1 1 1)"2-(r(i+ 1 )-x 1 1 2jA2)/2/sigma); gama 1 2(k)=exp((-(r(i)-x 12 1)A2-(r(i+1)-x 122)"2)/2/sigma); gama23 (k)=exp((-(r(i)-x23 1)"2-(r(i+l )-x232)"2)/2/sigma); gama24(k}=exp((-(r(i)-x24 l)"2-(r(i+ 1 )-x242)"2)/2/sigma); gama3 1 (k)=exp((-(r(i)-x3 1 1)"2-(r(i+l )-x3 1 2)fi2)/2/sigma); garna32(k)=exp((-(r(i)-x32 1)A2-(r(i+l)-x322)A2)/2/sigma);
gama43(k)=exp((-(r(i)-x43 1 )"2-(r(i+ 1 )-x432)^2)/2/sigma); gama44(k)=exp((-(r(i)-x44 ! )"2-(r(i+ 1 )-x442)"2)/2/slgma);
end
aIfal(1 )=gamal 1 (l);alfa2(1)=gamal2(I);alfa3(1)=0;alfa4(1)=0; for i=2:n
alfal (i)=alfa l (i- 1 )*gamal 1 (i)+alfa3(i- l)*gama3 1 (i); alfa2(i)=alfal(i- l)*gamal2(i)+alfa3(i-l)*gama32(i); alfa3 (i)=alfa2(i- 1 )*gama23(i)+alfa4(i- l)*gama43(i); alfa4(i)=alfa2(3- l)*gma24(i)+alfa4(i- i { i ) ;
end
beta 1 (n- l)=garnai I (n);beta3(n- l)=gama3 l (n);beta2(n- l)=O;beta4(n- l)=0; for i=n-2:- 1 : 1
beta1 (i)=beta 1 (i+ 1 )*gamal 1 (i+ I)+beta2(i+ 1 )*gama 12(i+ 1); beta2(i)=beta3(i+l)*gama23(i+ l)+beta4(i+ l)*garna24(i+l); beta3(i)=betal (i+l)*gama3 1 (i+l)+beta2(i+l)*gama32(i+l); beta4(i)=beta3(i+ 1 )*garna43(i+ l)+beta4(i+ l)*gama44(i+ 1 );
end
for i=2:n-2 pay=(alfal (i-l)*gamaI 1 (i)*betal(i)+alfa2(i-l)*gama23(i)*beta3(i)+ ...
alfa3(i- l)*gama3 1 (i)*betal (i)+alfa4(i- l)*gama43(i)*beta3(i)); payda=(alfal (i- l)*gamal2(i)*beta2(i)+alfa2(i- l)*garna24(i)*beta4(i)+.
alfa3(i- l)*gama32(i)*beta2(i)+alfa4(i- l)*gama#(i)*beta4(i)); L-a(i)=logO,ay/payda);
end for i= 1 :n-2
if L-a(i)>O a(i)=O;
else a(i)= 1 ;
end end a(n)=O; hata(snrtl)=hata(snr+ 1 )+sum(abs(u-a));
end hata(snrt 1); bit-hata-orani(s&l)=hata(snrt-1)/1 OO/carpan(snr+ 1 )
end sni=0:5:25; semilogy(snr,bit-hata-orani), title(vMAP');xlabeI('Eb/NO(dB)');ylabel'Bit Error Rate'); zaman=cputime-t
function L-all= sova(rec-s, g, L-a, ind-dec)
totallength = length(L-a); [n,K] = size(g); m = K - 1; nstates = 2"m; infiy = 1 el 0;
% Set up the trellis defured by g. [next-out, next-state, last-out, last-state] = tre!lis(g);
% Initialize path rnetrics to -1nfty for t= 1 :totallength+ 1
for state= 1 :nstates path-rnetric(state,t) = -Infty;
end end
% Trace forward to compute all the path metrics path-metric(1 , 1 ) = 0; for @= 1 :totallength
y = rec-s(2*t-l:2*t); for state=l :nstates
symO = last-out(state, 1 :2); syml = last-out(state,3:4); state0 = last-state(state, 1); state1 = last_state(state,2); MkO = y*sym0' - L-a(t)/2 + path-metric(state0,t); Mkl = y*symlt 3 L-a(t)/2 + path-rnetric(state1 ,t);
if MkO>Mkl path-metric(state,t+ l)=MkO; Mdiff(state,t+l) = MkO - Mkl; prev-bit(state, t+ 1) = 0;
else path-metxic(state,t+l)=MStl ;
Mdiff(state,t+ 1 ) = Mk 1 - MkO; prev-bit(state,t+l) = 1 ;
end
end end
% For decoder 1, trace back fi-om all zero state, & for decoder two, trace back from the most likely state if ind-dec = 1
mlstate(totallength+1) = 1 ; else
mlstate(totallength+l) = find( path-metric(:,totallength+ l)==maxCpath~metricf:,totallength+~)) ); end
% Trace back to get the estimated bits, and the most likely path for t=totallength:- 1 : 1
est(t) = prev-bit(mlstate(t+l),t+l); mlstate(t) = last-state(mlstate(t+l), est(t)+l);
end
% Find the minimu111 delta that corresponds to a cornpitition path with different info. bit estimation. & Give the soft output for e l :totallength
llr = Infty; for i=O:delta
if t+i<tatallength-t-1 bit = 1 -est(t+i); temp-state = last-state(mlstate(t+i+ I), bit+l); for j=i-1 :-1 :O
bit = prev-bit(temp-state,t+j+l); temp-state = last-state(temp-state, bit+l);
end if bit-=est(t)
Ilr = rnin( llr,Mdiff(mlstate(t+i+ I), t+i+ 1) ); end
end end L-all(t) = (2*est(t) - 1) * llr;
end
Simulation Programs of Combined Hybrid ARQ and Adaptive Scheduling
c1c;clear all; PsO= 1 -( 1 -0.0 1 65)."8; PSI=] -(I-4.88*10."-8)."8; PO=O.O952;P 1=0.9048;z= 1 ;xl=O;x2=0; for n=79:-155
kbn(z)=55/n; j 1 =floor((2*n)-55/2)+1; j2=floor(n-55/2)+ 1 ;
for j=fix(j2):n %comb 1 (j)=factorial(n)/(factorial(j)*factorial(n-j)); x l=x l+(factorial(n)/(factoria1~)*factorial(n-j))*P~O.~j*(l -PsO).*(n-j));
end % Prl=Pr2=xl for k=fixCj 1):2*n % comb2=factorial(2*n)/(factorialO')"facto~al(2*n-j)); c = f a c t o r i a l ( 2 * n ) / ( f a c t o r i a l ( k ) * f a c t o ~ k * ( l -PsO)./'(n-k);
x2=x2+c; end % Pr3=x2 Ets(z)=( 1 +x l+(x 1 *x 1 *x2)-(x 1 *x 1 *(x2-"2)))/(1 -(x 1 ."2)*(x2."2)); NO(z)=( 1 /Ets(z))*(55/n); z=z+ 1 ; end yl=Pl(n); % - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - q=1 ;x3=0;x4=0; for nl=79:-1:55 for l=fix(j2):nl % comb3=factorial(n 1 )/(factorial(j)* factorial(n 1 -j)); x3=x3+factorial(nl)/(factorial(l)*factorial(nl-1))*Psl ."l*(l-Ps l)."(nl-1);
end y2=p2(n); % Pr 1 =Pr2=x3 for rn=fix(j l):2 *n 1 % comb4=factorial(2*nl)/(factorialO')"facto~al(2*nl-j));
x4=x4+factorial(2*n l)/(factorial(m)*factoriaI(2*n 1 -m))*Ps I .%*( 1 -Ps 1 )."(n 1 -m); end y373(n); % Pr3=x4 Etsl (q)=( 1 +x3-tx3*x3 *x4-x3*x3 *~4.~2)/(1 -x3 ."2*~4."2); N 1 (q)=( 1 /Ets(q))*(SS/n 1 ); q=q+ 1 ; end
N=O; for t= 1 : length(Ets)
N(t)=PO*NO(t)+P I *N 1 (I); end % Ien=length(N); x=0.625:.025:0.85 plot(x,yl ,'-',x,y2,'-*',x,y3,'--'); Iegend('type-I hybrid ARQq,'type-Il hybrid ARQ','type-I1 hybrid ARQ&adaptive fair-queueing'); %subplot(3,172);p10t(x,y2,'--');legend('type-I1 hybrid ARQ') %subplot(3,1 ,3);plot(x7y3,'-"');Iegmd('type-I1 hybrid ARQ&adaptive fair-queueing'); xlabel(Traffic Load'); ylabel('avg. delay of UBR traffic (ms)');
%ERROR CONTROL IN WIRELESS ATM % %CODING RATE Vs AVERAGE DELAY k=input('enter the number of info. bytes'); n=55: 79; e0=0.0165; e1=1.88* loA(-8); psO=O. 124; psl=0.0000003 9; pr03=0; for i=99.5: 126 f;03=(prod(l:(2*n))./(prod(l :i).*prod( 1 :(2*n-i)))).*(psO."i)."(ll-ps0).*(2*n-i)); pr03=pr03+f03;
end y 1 =delay1 (k); pro1 =o; for i=36.5:63
f0 1 =(prod(l :(n))./(prod(l 5). *prod( 1 :(n-i)))).*@sO."i).*(( 1 -psO)."(n-i)); prOl=prOl+fOl;
end pr13=0; y2=delay2(k);
for i=99.5: 126 fI3=Cprod(l:(2*n))./(prod(l: i).*prod(l:(2*n-i)))).*Cpsl ."i).*((l-ps 1)."(2*n-i)); pr13-pr13-tf13;
end prl l=O; for i=36.5:63
fl l=@rod(l :(n))./(prod(l :i).*prod(I :(n-i)))).*(psl ."i).*((l -p~l).~.(n-i)); prl l=prl l+f l l ;
end
plot(x,yl,'-',x,y2,'-*',x,y3,'--'); legend('type-I hybrid ARQt,'type-I1 hybrid ARQt,'type-I1 hybrid ARQkadaptive fair-queueing'); %plot(x,y2,'y');legend('type-I1 hybrid ARQ'); %plot(x,y3,'r');legend('type-I1 hybrid ARQ&adaptive fair-queueing'); xlabel('coding rates ----> '); ylabel('Average defay(ms)----> I);
k=55; n=55:79; %e0=0.0165; %e1=4.88*1 OA(-8); psO=O. 124; ps 1=0.00000039; pr03=0; for i=99.5: 126
f03=(prod(I :(2*n))./(prod(l :i).*prod(l:(2*n-i)))).*@~O.~i).*((l -p~0).~(2*n-i)); pr03=prO3-tf03;
end prOl=O; for i=36.5:63
f l l =Cprad(l :(n))./(prod(l :i).*prod(l :(n-i)))).*(psO."i).*I(l -psO)."(n-i)); prOl=prOl-tf01;
end prl3=0; for i=99.5: 126 fl3=(prod(l:(2*n))./(prod(l :i).*prod(l:(2*n-i)))).*@sl ."i).*((l -psl)."(2*n-i)); prl3=prl3+fl3;
end prl1=0; for i=36.5:63
fl l=(prod(l :(n))./(prod(l :i).*prod(l :(n-i)))).*(psl .Ai).*((l-psI).A(n-i)); prl l=prl l t f l l ;
end
t0=(1 -(pro1 .*pro 1 .*pro3 .*pr03))/(1+prO 1+(prO 1 .*pro1 .*pd3)- (pro 1 .*prOl. *pr03. "pr03)); tl=(l-(prl l.*prl l.*prl3.*pr13))/(1+prl l+@rl l.*prl l.*prl3)- tprl l.*prl Zl*p-l3.*prl3)); n=55:79; yl=to(); y2=to; y3=t2(); x=[ 0.72 0.725 0.735 0.75 0.775 0.8 0.825 0.85 0.875 0.9 0.925 0.95 0.975 I];
plot (x,yl ,'-',x,y2,'-*',x,y3,'--');legend ('type - I hybrid ARQ','type - I1 hybrid ARQ1,'type - I1 hybrid ARQ&adaptive fair-queueing'); %plot (x7y2,Y ');legend ('type - I1 hybrid ARQ'); %plot (x,y3,'Pf);legend ('type - I1 hybrid ARQ&adaptive fair-queueing'); %plot(x,yl ,'k-',~,y2,'k"-',~,y3,'k*-',x,y4,'k.-',x,y5,'k--'); axis(l0.72 1 0.7 11); %legerid('type-I hybrid ARQ', 'type-I1 hybrid ARQ', 'type-11 hybrid ARQ&adaptive fair- queueingl,'type-I hybrid ARQ(analysis)','type-I1 hybrid ARQ(ana1ysis)'); xlabel('coding rates R=Wn k=55'); ylabel('throughput');
Simulation Programs of Decentralised CAC
%eff.bw and equvi.capacity knction B=cac(B 1); clc; clear all; Psu l=[]; bw 1 =[I; eb 1 =I]; c 1 =[I; %Xcc=5; N=5; t 1 =[I; %ad= 10; pbr=2O*(l OA(-6));xa l=[]; Asc=1 .30A(-3); Xbc= 150; %x1=150; %xl=l; Psu=(1/40); %p 1 =0.4; %p 1 =2; clr= 1 OA(-2); Bbs=150; Np= 1 0; d=-Iog(clr)lBbs; %x=[1.40 0.3 1.20 0.1 1.09 0.08 1.07 0.06 1.05 0.041; %x=[500 56 57 5001; x=[2120 1060530265 I28 6432 16 841; t=O; j=1; for n= 1 :Np,
y= 1 in; z=o; for i= 1 :n,
%x=rand( 1 ); %disp(x);
z=z+exp(d*x(i)); end %for t=0:20:200,
xaG)=t; aG)=(l/t)*log(y*z); disp(ati1); bw(j)=(aQ)/d); %t=t+20; xa 1 =[xal ,xa];
%end %plot(xa,eb);
%for Psu=0:20:200, s=Asc*t*( 1 -Psu)-Xbc; u=sqrt((((Asc*t)*(l -P~u))-Xbc)~2); g=(4*Xbc*P~~*Asc*t"(l -Psu)); n 1 =4*Asc*t*( 1 -Psu); t=t+20; c(j)=(l -pbr)*((s+u+g)/~~l); eb=bw-clj); j=j+ 1 ; Psul =[Psu 1 ,Psu]; bw 1 =[bw 1 ,bw]; c 1 =[c 1 ,c]; tl=[tl ,t]; eb 1 =[eb 1 ,eb]; disp(b w) ;
end for k=1:10, if eb(k)<bw(k)
disp('Accept the Connection'); else
disp('Reject the connection');
end k=k+ 1 ; end subplot(2,2,1); plot(xa,eb,'k-*',xa,bw,'k: *I); xlabel('tirne,slots'); ylabel('Bandwidthl); legend('estimatedf,'available'); title('Estimation of Bandwidth'); %T=[T,tJ; %C=[C,c]; %BW=[B W,bw]; %plot(BW);
% TO compare the throughput of Decentralised and centralised % CENTRALJSED b c t i o n T=cacthral3(T 1);
PL 1 =4; PL2=0; PL2=[]; i= 1 ; j=O; %DP=23.2+4*((34+x)/(Bps/(l OA6)), DP=O; %CD=PR+PLI +DP; for j= 1 :5, DPCj)=23.2+4*((34+x(i))/(Bps(j)/(( 1 OA4)/60))); CD=PR+PLI +DP('j);
end Tp=O; i=l; for PL= 10: 100: 1000,
Tp(i)=(PL*2)/(CD); %Tp(i)=PL/(CD); ~=i+l ; PL2=[PL2,PL];
end disp(Tp); %semilogy(PL2,Tp,'k-*I);
% DECENTRALISED Lbch=9; Lfch=6; Lach=3; Lrch=7; Bps=3 0; Lul=4+(9/Bps}; Llch=5OO-(Lbch+Lfch+Lach+Lul+Lrch); Npdu=(Llch*Bps/54); X=[1234005006007008009001000]; t=O; for i=1:0.01:10, t(i)=Npdu*(X(i)*O.00048/1 OO)/(((X(i))+4)*0.002); disp(t);
end if t>Tp
disp(Decentra1ised has highest thr~ughput'); else
disp('Centra1ised has highest throughput'); end subplot(2,2,4);
plot(X,t,'k: *',PL2,Tp,'k-*'); xlabel(No.of Time slots(s)'); yiabel('Throughput'); legend('Decentralisedt,'Centralised'); title('Decentra1ised Vs Centralised');
clc; clear all; exno=[l 2 3 4 5 ] hoeqno=[Q. I 0.2 0.3 0.4 0.51; reqcall=input('Enter the call value= '); newcall=input('Enter the newcall value= I);
Tn=5; %for class = 1 :4,
%exn0(~la~~)=e~n0(~1as~)+ 1 ; %end
if(reqcall==newcall) for i=l :Tn, eqno(i)=exno(i)+hoeqno(i);
end end If--.input('Enter the value of last flag= I); qq=input('Enter the value QoS guarantee= '); if qq==lf
cIass=input('Enter the class vaIue= '); CBR=input('Enter the value of CBR= '); if class=CBR
jitter=cbrc2(1); jb=input('Enter the value of jitter bounds= '); if jitter>jb
99-0; disp(Cannot admit the call');
else disp('Admit the new call as CBR');
end else
cc=input('Current calculated value= '); cc=cc+ 1 ; Ivbr=input('Enter the value of lvbr= '); if cc==lvbr
lf=O; db=input('Enter the delay bound= 3; delay=vbw2( 1);
if delay>db qq=O; cc=cc+ 1 ; If=O; disp('Admit the new call as VBR');
end else
dispflCannot admit the new call'); if cc==lvbr
lf=O; end
end end
end if qq-1
disp(Wew call is blocked'); end
% To compare the throughput of Decentralised and centralised clc; close all;% CENTRALISED PR=20; %x=3; x=[30 40.5 60 90 180 260 340 450 540 6001; Bps=[6 9 12 18 36 45 67 78 89 1001; PL 1 =4; PL2=0; PL2=[]; i=l; j=O; %DP=23.2-t4*((34+x)l(Bps/(l OA6))); DP=O; %CD=PR+PLl +DP; forj=l:lO, DP(j)=23.2+4*((34+x(j))/(Bps(j)/((l OA4)/60))); CD(j)=PR+PLl -i-DPg');
end Tp=O; i=1; for PL=10:200: 1000,
Tp(i)=(PL*2)/(CD(i)); %Tp(i)=P W (CD); i=i+l ; PL2=[PL2,PL];
end
% DECENTRALISED Lbch=9; Lfch=6; Lach=3; Lrch=7; Bps=30; Lul=4+(9/Bps); Llch=5OO-(Lbch+Lfch+Lach+Lult-Lrch); Npdu=(Llch*Bps/53); X=[1 2 3 400 500 600 700 800 900 IOOO]; t=o; for i=1:0.01:10, t(i)=Npdu*(X(i)*O.00048/1 OO)/(((X(i))+4)"0.002); t 1 (i)=Npdu*(X(i)*O.O004 8/ 1 OO)/(((X(i))+4)*0.02) disp(t);
end pIot(X,t,'k:*',PL2,Tp,'k-"'); xlabel(Wo.of Time slots'); ylabel('Throughput'); legend('Decentralised', 'Centralised');
%eff.bw and equvi.capacity clc; clear all; Psu 1 =[I; bwl=[]; eb 1 =[I; cl=[]; %Xcc=5; N=5; tl=[]; %ad= 10; pbr-20*(l W(-6));xa l=[1; Asc=1.30"(-3); Xbc= 1 50; %x1=150; %xl=l; Psu=( 1 /40); %p 1-0.4; %p l=2;
clr= l OA(-2); Bbs=150; Np= 1 0; d=-log(clr)/B bs; %x=[1.40 0.3 1.20 0.1 1.09 0.08 1.07 0.06 1.05 0.041; %x=[500 56 57 5001; x=[21201060530265128 643216841; t=O; j=1; for n= 1 :Np, y- l/n; 250; for i= 1 :n,
%x=rand( 1 ); %disp(x);
z=z+exp(d*x(i)); end %for t=0:20:200,
xa(i)=t; a(j)=(l /t)*Iog(y*z); disp(a0')); bw(j)=(a(j)/d); %t=t+20; xal=[xal ,xa]; %end
%pIot(xa,eb); %for Psu=0:20:200, s=Asc*~ *( 1 -Psu)-Xbc; u=sqrt((((Asc*t)*(l -Psu))-Xbc)"2); g=(4*Xbc*Psu*Asc*t*( 1 -Psu)); nl=4*Asc*t*(l-Psu); t=t+20; cG)=(l -pbr)*((s+u+g)/n 1); eb=bw-c(j); j=j+l; Psul=[Psul,Psu]; bwl=[bwl ,bw]; c 1 =[c 1 ,c]; tl=[tl,t]; ebl=[ebl ,eb]; disp(bw);
end for k=1:10, if eb(k)<bw(k)
disp('Accept the Connection'); else
disp('Reject the connection');
end k k + 1 ; end plot(xa,eb,'k-*',xa,bw,'k:*'); xlabel('time(s1ots)'); ylabel('Bandwidth(spaces)'); legend('estimatedt,'avaiIable');
% max no. of connections %pr== 1 00; clc; close all; a= 1 0; %pr=200; N=10; ps=0.9; 1=0.4; r=0.2; i=l; %T= 10; pr=0.9; for T=0:20:200,
xax(i)=T; z=((aA2) * (2-pr));
x=l 6*r*(psA2);6 y=8*pr*((l*T)+(r*ps)-N); %y 1 =&*pr*(l *T+r*ps-N); %y(i)=8*pr*(I*T+r*ps-N); % y(i)=r; k(i)=( 1 /(2*pr))*(z+(4*N)+(4*1 *T)-2 *r*ps-a*(sqrt(((aA2)* (2-pr)A2)+(16*N)+y+x))); %xax(i)--pr; i=i+ 1 ; end j=1; for prl=O:20:200,
prx(j)=pr 1 ; lCj)=(prl *ps+a)/ 1 0; j=j+ 1 ; end
%disp(k); %disp(z); %plot(xax,k); plot(xax,k,'k-*',prx,l,'k:*"); xIabel('time(slots)'); ylabel(TJo.of Connections'); legend('Decentralised','Centralised');
clc; close ail; C=(1-0.05)*(1-0.03)*(1-0.03); C 1=(1-0.05)*(1-0.03);
TCI=C1/2; disp(TC 1); %Th=I 00*(1 W(-3)); %Th2=[]; i= 1; j= 1 ;D=0; C=O; I= 1 00; Th2=[]; for Thl=l:lO:lOO, AV(i)=Th 1 /(2*( 1 -TC)); AVI (i)=Thl/(2*(1 -TCl)); CCj)=(AV(i)*TC); D('j)=(AVl (i)*TC l)/l 0; i=i+l; j=j+ 1 ; ThZ=[Th2,Thl]; end %end disp(C); plot(Th2,C,'k-*',ThZ,D,'k:*'); xlabel('Ho1ding Time'); ylabel('Max Delay(ms)'); legend('Cmtra1ised ','Decentralised');
% Algorithm for Decentralised Call Admission Control clc ; clear all; conn=input('Enter the value of connection= 3; f=input('Enter the value fixed Connection= '); if conn==f
%estimate bandwidth Ebandwidth=cac( 1 ); %determine no.of connections Connection=cacconnal2( 1); delay=cacdelayaf3(1); throughput=cacthral3(1);
else BS=input('Enter the value of Bandwidth= '); Allocate=input('Enter the allocation= '); if(BS==AIlocate) Cor~ecticn=cacconna12(1); disp('Accept the connection'); delay=cacdelayal3(1); throughput=cacthral3(1);
else disp('Re1ease the Connection');
end end %calculate Delay