计算机通信与网络
实验报告
姓 名:徐学 号:班 级:通信五班上课时间:周四 一 得 15081525 3-5
实验名称:Simulation on Performance of Data Link
Control Protocols
一、 实验目的
1. Realizing the principles of Data Link Control Protocols. 2. useing the software called matalab to simulate the Performance 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 in error for the following error-control techniques: a. Stop-and-wait b. Go-back-N with w=7 c. Go-back-N with w=127 d. Selective reject with w=7
e. Selective reject with w=127
Do all of the preceding for the following values of a: 0.1, 1, 10, 100. Draw conclusions 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 1 semilogx(a,U,'b'); //using function to depict line hold on
U=utilization(a,7); //when length of window is 7 semilogx(a,U,'k'); hold on
U=utilization(a,127); //when length of window is 127 semilogx(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 to
show 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 to
calculate the U
semilogx(a,U,'r'); //using function to depict line hold on
U=selective_reject(a,7,p); //using the formula to
calculate the U
semilogx(a,U,'g'); hold on
U=gobackn(a,7,p); semilogx(a,U,'b'); hold on
U=selective_reject(a,127,p);
semilogx(a,U,'k'); hold on
U=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) end
function 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+1
U=W(1-p)/(2a+1) when w<2a+1
function 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+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]; for i=1:4
subplot(2,2,i) lab2_draw(a(i))
title(stract('a=',num2str(a(i)))) // draw four different
lines
end
function lab2_draw //the formula to
draw the first line
p=0:0.1:1000; U=stopandwait(a,p); semilogx(a,U,'r');
hold on
U=selective_reject(a,7,p); semilogx(a,U,'g'); hold on
U=gobackn(a,7,p); semilogx(a,U,'b'); hold on
U=selective_reject(a,127,p); semilogx(a,U,'k'); hold on
U=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 of go-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 Link Control Protocols. Besides I write code to testify those principles, which
offers me deep insight of those two methods. As for me confusion, I don’t know the error correction part of CRC and how to modify the parity check to make more efficient. 教师评语:图不够清晰 成绩:A
相关推荐: