www.gusucode.com > ISDN网络模型源码程序 > ISDN网络模型源码程序/code/isdntraffic.m
clear all; clc; s1=0; for u=1:20 for t=1:20 ton([u],[t])=0.35*6*randint(1,1,[0,1]); end; end; for u=1:20 for t=1:20 s1=ton([u],[t])+s1; totalonvoice(t)=s1; end; s1=0; end; [d]=1000*[0 128 512 1024]; s2=0; for u=1:20 for t=1:20 ton([u],[t])=0.35*randint(1,1,[0,1]); end; end; for u=1:20 for t=1:20 if((ton([u],[t])>=0)&(ton([u],[t])<=2)) tond([u],[t])=ton([u],[t])*d(1); end; if((ton([u],[t])>=3)&(ton([u],[t])<=5)) tond([u],[t])=ton([u],[t])*d(2); end; if((ton([u],[t])>=6)&(ton([u],[t])<=8)) tond([u],[t])=ton([u],[t])*d(3); end; if((ton([u],[t])>=9)&(ton([u],[t])<=10)) tond([u],[t])=ton([u],[t])*d(4); end; end; end; for t=1:20 for u=1:20 s2=(tond([u],[t]))+s2; totalondata(t)=s2; end; s2=0; end; [x]=randint(1,1,[1,5]); s3=0; a=20; [p]=[0 0 0.5 0.5; 0.117 0 0.33 0.5; 0.4 0.2 0 0.4; 2 0.3 0.5 0]; ts1=exppdf(x,7); ts2=exppdf(x,1); ts3=exppdf(x,3); ts4=exppdf(x,4); [d]=[3.75 2.9 3.4 6]*power(10,6); for u=1:20 for t=1:5 p1([u],[t])=ts1*p(1,3)*d(1)*a; end; for t=6:10 p1([u],[t])=ts2*p(2,4)*d(2)*a; end; for t=11:15 p1([u],[t])=ts3*p(3,2)*d(3)*a; end; for t=16:20 p1([u],[t])=ts4*p(4,2)*d(4)*a; end; end; s5=0; for u=1:20 for t=1:20 s3=p1([u],[t])+s3; totalonvideo(t)=s3; end; s3=0; end; buffer(1)=0; for t=1:20 totaltraffic(t)=0.05*totalondata(t)+.15*totalonvoice(t)+0.8*totalonvideo(t); buffer(t+1)=totalondata(t)-0.05*totalondata(t)+totalonvoice(t)-0.15*totalonvoice(t)+totalonvideo(t)-0.8*totalonvideo(t); totaltraffic(t+1)=totaltraffic(t)+buffer(t+1); if totalonvideo(t)<23.25*10^6 totaltraffic(t)=totalondata(t)+totalonvoice(t)+0.8+totalonvideo(t)+buffer(t+1); end; end; bar(totaltraffic); totaltraffic for i=1:20 if(totaltraffic(i)<=155*power(10,6)) rem(i)=0; else rem(i)=totaltraffic(i)-(155*power(10,6)) end; end; rem xlabel('time'); ylabel('traffic'); title('ISDN traffic model');