杭州电子科技大学通信工程计算机网络的实验报告2doc.docx
《杭州电子科技大学通信工程计算机网络的实验报告2doc.docx》由会员分享,可在线阅读,更多相关《杭州电子科技大学通信工程计算机网络的实验报告2doc.docx(8页珍藏版)》请在冰点文库上搜索。
杭州电子科技大学通信工程计算机网络的实验报告2doc
计算机通信与网络
实验报告
姓名:
徐一得
学号:
15081525
班级:
通信五班
上课时间:
周四3-5
实验名称:
SimulationonPerformanceofDataLinkControlProtocols
一、实验目的
1.RealizingtheprinciplesofDataLinkControlProtocols.
2.useingthesoftwarecalledmatalabtosimulatethePerformanceofDataLinkControlProtocols.
二.实验原理
流量控制实际上是对发送方数据流量的控制,使其发送率不致超过接收方所能承受的能力。
这个过程需要通过某种反馈机制使发送方知道接收方是否能跟上发送方,也即需要有一些规则使得发送方知道在什么情况下可以接着发送下一帧,而在什么情况下必须暂停发送,以等待收到某种反馈信息后继续发送。
二、实验内容与要求
UsingthesameassumptionsthatareusedforFigure7.13inAppendix7A,plotlineutilizationasafunctionofP,theprobabilitythatasingleframeisinerrorforthefollowingerror-controltechniques:
a.Stop-and-wait
b.Go-back-Nwithw=7
c.Go-back-Nwithw=127
d.Selectiverejectwithw=7
e.Selectiverejectwithw=127
Doalloftheprecedingforthefollowingvaluesofa:
0.1,1,10,100.Drawconclusionsaboutwhichtechniqueisappropriateforvariousrangesofa.
三、实验程序与结果
Project
(1)
a=0:
0.1:
1000;
U=utilization(a,1);//whenlengthofwindowis1
semilogx(a,U,'b');//usingfunctiontodepictline
holdon
U=utilization(a,7);//whenlengthofwindowis7
semilogx(a,U,'k');
holdon
U=utilization(a,127);//whenlengthofwindowis127
semilogx(a,U,'m');
title('figure7.12slind-windutilizationasafunctionofa')
ylabel('utilization')
xlabel('a')
text(0.7,0.5,'\leftarroww=1');//notingarrowtoshowwhatthelineis
text(8,0.6,'\leftarroww=7');
text(130,0.8,'\leftarroww=127');
functionU=utilization(a,w)
U=1.*(w>=2*a+1)+w./(2*a+1).*(w<2*a+1);
End//formulaforutilizationU=1/(1+2a)
Project
(2)
a=0:
0.1:
1000;
p=1/1000;
U=stopandwait(a,p);//usingtheformulatocalculatetheU
semilogx(a,U,'r');//usingfunctiontodepictline
holdon
U=selective_reject(a,7,p);//usingtheformulatocalculatetheU
semilogx(a,U,'g');
holdon
U=gobackn(a,7,p);
semilogx(a,U,'b');
holdon
U=selective_reject(a,127,p);
semilogx(a,U,'k');
holdon
U=gobackn(a,1277,p);
semilogx(a,U,'y');
title('figure7.13ARQutilizationasafunctionofa(P=10-3)')
ylabel('utilization')
xlabel('a')
text(0.2,0.2,'stopwait\rightarrow');
text(0.23,0.7,'w=7Go-back-N&\newlinew=7selective_reject\rightarroww=7');
text(10,0.8,'w=127\newlineGo-back-N\rightarrow');
text(110,0.7,'\leftarroww=127');
functionU=stopandwait(a,p)
U=(1-p)./(1+2*a);//U=(1-p)/(1+2a)
end
functionU=selective_reject(a,w,p)
U=(1-p).*(w>=2*a+1)+w.*(1-p)./(2*a+1).*(w<2*a+1);
End//U=1-pwhenw>=2a+1
U=W(1-p)/(2a+1)whenw<2a+1
functionU=gobackn(a,w,p)
U=(1-p)./(1+2.*a.*p).*(w>=2*a+1)+w.*(1-p)./(2.*a+1)./(1-p+w.*p).*(w<2*a+1);//U=(1-p)/(1+2p)whenw>=2a+1
U=w(1-p)/(2a+1)(1-p+wp)
end
Project(3)
figure
set(gcf,'position',[300,0,800,800],'color','w')//当前Figure对象的句柄值
a=[0.1,1,10,100];
fori=1:
4
subplot(2,2,i)
lab2_draw(a(i))
title(stract('a=',num2str(a(i))))//drawfourdifferentlines
end
functionlab2_draw//theformulatodrawthefirstline
p=0:
0.1:
1000;
U=stopandwait(a,p);
semilogx(a,U,'r');
holdon
U=selective_reject(a,7,p);
semilogx(a,U,'g');
holdon
U=gobackn(a,7,p);
semilogx(a,U,'b');
holdon
U=selective_reject(a,127,p);
semilogx(a,U,'k');
holdon
U=gobackn(a,127,p);
semilogx(a,U,'y');
ylabel('utilization')
xlabel('p')
legend('stop-and-wait','Go-back-Nwithw=7','Go-back-Nwithw=127','selective_rejectwithw=7','selective_rejectwithw=127',3)
end
四、实验结果分析
(1)
Thisgraphshowsthemaximumutilizationachievableforwindowsizesof1,7127.Awindowsizeof1correspondstostopandwait,inwhichshowswhenaftersendingaframe,thesenderhavetowaitanacknowledgetosendantherframe.Inthiscondition,whena>>thetimeofsending,wecanseeittheutilizationisverylow.Awindowsizeof7isadequateformanyapplication,asithasprettybigbuffingarea,whichcanincreasetherateofutilization.Awindowsizeof127isadequateforlargervaluesofa.
(2)
Wehaveignoreerrorsinacknowledgementframesand,inthecaseofgo-back-N,errorsinretransmittedframesotherthantheframeinitiallyinerror.asaresult,whena>>t,theefficiencyofselective-rejectismosthigh.
(3)
(1)Whena=0.1or1,W=7or127>>2a+1,sothelinesofgo-back-Nwithn=7andgo-back-Nwithn=127overlap,selective-rejectwithw=7andselective-rejectwithw=127alsooverlap.
Whena=10,则selective-rejectwithwandgo-back-Nbothare分段函数
五、实验问题解答与体会
Throughthefirstnetexperiment,IrealizetheprinciplesofDataLinkControlProtocols.BesidesIwritecodetotestifythoseprinciples,whichoffersmedeepinsightofthosetwomethods.Asformeconfusion,Idon’tknowtheerrorcorrectionpartofCRCandhowtomodifytheparitychecktomakemoreefficient.
教师评语:
图不够清晰
成绩:
A