当前位置:文档之家› 杭州电子科技大学通信工程计算机网络的实验报告2.doc

杭州电子科技大学通信工程计算机网络的实验报告2.doc

计算机通信与网络实验报告姓名:徐一得学号:15081525班级:通信五班上课时间:周四3-5实验名称:Simulation on Performance of Data Link Control Protocols一、实验目的1.Realizing the principles of Data Link Control Protocols.eing the software called matalab to simulate thePerformance of Data Link Control Protocols.二.实验原理流量控制实际上是对发送方数据流量的控制,使其发送率不致超过接收方所能承受的能力。

这个过程需要通过某种反馈机制使发送方知道接收方是否能跟上发送方,也即需要有一些规则使得发送方知道在什么情况下可以接着发送下一帧,而在什么情况下必须暂停发送,以等待收到某种反馈信息后继续发送。

二、实验内容与要求Using the same assumptions that are used for Figure 7.13 in Appendix 7A,plot line utilization as a function of P, the probability that a single frame is inerror for the following error-control techniques:a. Stop-and-waitb. Go-back-N with w=7c. Go-back-N with w=127d. Selective reject with w=7e. Selective reject with w=127Do all of the preceding for the following values of a: 0.1, 1, 10, 100. Drawconclusions about which technique is appropriate for various ranges of a.三、实验程序与结果Project(1)a=0:0.1:1000;U=utilization(a,1); //when length of window is 1semilogx(a,U,'b'); //using function to depict linehold onU=utilization(a,7); //when length of window is 7semilogx(a,U,'k');hold onU=utilization(a,127); //when length of window is 127semilogx(a,U,'m');title('figure 7.12 slind-wind utilization as a function of a')ylabel('utilization')xlabel('a')text(0.7,0.5,'\leftarrow w=1'); //noting arrow toshow what the line is text(8,0.6,'\leftarrow w=7');text(130,0.8,'\leftarrow w=127');function U=utilization(a,w)U=1.*(w>=2*a+1)+w./(2*a+1).*(w<2*a+1);End //formula for utilization U=1/(1+2a)Project(2)a=0:0.1:1000;p=1/1000;U=stopandwait(a,p); //using the formula tocalculate the U semilogx(a,U,'r'); //using function to depict line hold onU=selective_reject(a,7,p); //using the formula tocalculate the Usemilogx(a,U,'g');hold onU=gobackn(a,7,p);semilogx(a,U,'b');hold onU=selective_reject(a,127,p);semilogx(a,U,'k');hold onU=gobackn(a,1277,p);semilogx(a,U,'y');title('figure 7.13 ARQ utilization as a function of a (P=10-3)')ylabel('utilization')xlabel('a')text(0.2,0.2,'stopwait\rightarrow ');text(0.23,0.7,'w=7 Go-back-N & \newline w=7 selective_reject\rightarrow w=7');text(10,0.8,'w=127\newline Go-back-N \rightarrow');text(110,0.7,'\leftarrow w=127');function U=stopandwait(a,p)U=(1-p)./(1+2*a); //U=(1-p)/(1+2a)endfunction U=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-p when w>=2a+1U=W(1-p)/(2a+1) when w<2a+1function U=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) when w>=2a+1U=w(1-p)/(2a+1)(1-p+wp) endProject(3)figureset (gcf,'position',[300,0,800,800],'color','w') //当前Figure对象的句柄值a=[0.1, 1,10,100];for i=1:4subplot(2,2,i)lab2_draw(a(i))title(stract('a=',num2str(a(i)))) // draw four differentlines endfunction lab2_draw //the formula todraw the first line p=0:0.1:1000;U=stopandwait(a,p);semilogx(a,U,'r');hold onU=selective_reject(a,7,p);semilogx(a,U,'g');hold onU=gobackn(a,7,p);semilogx(a,U,'b');hold onU=selective_reject(a,127,p);semilogx(a,U,'k');hold onU=gobackn(a,127,p);semilogx(a,U,'y');ylabel('utilization')xlabel('p')legend('stop-and-wait','Go-back-N with w=7','Go-back-N with w=127','selective_reject with w=7','selective_reject with w=127',3)end四、实验结果分析(1)This graph shows the maximum utilization achievable for window sizes of 1, 7 127.A window size of 1 corresponds to stop and wait, in which shows when after sending a frame , the sender have to wait an acknowledge to send anther frame. In this condition , when a>>the time of sending ,we can see it the utilization is very low. A window size of 7 is adequate for many application, as it has pretty big buffing area, which can increase the rate of utilization. A window size of 127 is adequate for larger values of a.(2)We have ignore errors in acknowledgement frames and ,in the case of go-back-N, errors in retransmitted frames other than the frame initially in error.as a result ,when a>>t ,the efficiency of selective-reject is most high.(3)(1)When a=0.1 or 1, W=7 or 127>> 2a+1, so the lines ofgo-back-N with n=7 and go-back-N with n=127 overlap,selective-reject with w=7 and selective-reject with w=127 also overlap.When a=10,则selective-reject with wand go-back-N both are 分段函数五、实验问题解答与体会Through the first net experiment, I realize the principles of Data LinkControl Protocols. Besides I write code to testify those principles, whichoffers me deep insight of those two methods. As for me confusion, I don’t know the error correction part of CRC an d how to modify the parity check to make more efficient.教师评语:图不够清晰成绩:A。

相关主题