排队论的matlab仿真(包括仿真代码).docx

上传人:飞****2 文档编号:14471412 上传时间:2022-05-04 格式:DOCX 页数:21 大小:512.49KB
返回 下载 相关 举报
排队论的matlab仿真(包括仿真代码).docx_第1页
第1页 / 共21页
排队论的matlab仿真(包括仿真代码).docx_第2页
第2页 / 共21页
点击查看更多>>
资源描述

《排队论的matlab仿真(包括仿真代码).docx》由会员分享,可在线阅读,更多相关《排队论的matlab仿真(包括仿真代码).docx(21页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、精选优质文档-倾情为你奉上Wireless NetworkExperiment Three:Queuing TheoryABSTRACTThis experiment is designed to learn the fundamentals of the queuing theory. Mainly about the M/M/S and M/M/n/n queuing models.KEY WORDS: queuing theory, M/M/s, M/M/n/n, Erlang B, Erlang C.INTRODUCTIONA queue is a waiting line and q

2、ueueing theory is the mathematical theory of waiting lines. More generally, queueing theory is concerned with the mathematical modeling and analysis of systems that provide service to random demands. In communication networks, queues are encountered everywhere. For example, the incoming data packets

3、 are randomly arrived and buffered, waiting for the router to deliver. Such situation is considered as a queue. A queueing model is an abstract description of such a system. Typically, a queueing model represents (1) the systems physical configuration, by specifying the number and arrangement of the

4、 servers, and (2) the stochastic nature of the demands, by specifying the variability in the arrival process and in the service process. The essence of queueing theory is that it takes into account the randomness of the arrival process and the randomness of the service process. The most common assum

5、ption about the arrival process is that the customer arrivals follow a Poisson process, where the times between arrivals are exponentially distributed. The probability of the exponential distribution function is ft=e-t.l Erlang B modelOne of the most important queueing models is the Erlang B model (

6、i.e., M/M/n/n). It assumes that the arrivals follow a Poisson process and have a finite n servers. In Erlang B model, it assumes that the arrival customers are blocked and cleared when all the servers are busy. The blocked probability of a Erlang B model is given by the famous Erlang B formula,where

7、 n is the number of servers and A=/ is the offered load in Erlangs, is the arrival rate and 1/ is the average service time. Formula (1.1) is hard to calculate directly from its right side when n and A are large. However, it is easy to calculate it using the following iterative scheme:l Erlang C mode

8、lThe Erlang delay model (M/M/n) is similar to Erlang B model, except that now it assumes that the arrival customers are waiting in a queue for a server to become available without considering the length of the queue. The probability of blocking (all the servers are busy) is given by the Erlang C for

9、mula,Where =1 if An and =An if An. The quantity indicates the server utilization. The Erlang C formula (1.3) can be easily calculated by the following iterative schemewhere PB(n,A) is defined in Eq.(1.1).DESCRIPTION OF THE EXPERIMENTS1. Using the formula (1.2), calculate the blocking probability of

10、the Erlang B model. Draw the relationship of the blocking probability PB(n,A) and offered traffic A with n = 1,2, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100. Compare it with the table in the text book (P.281, table 10.3).From the introduction, we know that when the n and A are large, it is easy to calc

11、ulate the blocking probability using the formula 1.2 as follows. PBn,A= APB(n-1,A)m+APB(n-1,A)it use the theory of recursion for the calculation. But the denominator and the numerator of the formula both need to recurs( PBn-1,A) when doing the matlab calculation, it waste time and reduce the matlab

12、calculation efficient. So we change the formula to be : PBn,A= APB(n-1,A)n+APB(n-1,A)=1n+APBn-1,AAPBn-1,A=1(1+nAPBn-1,A) Then the calculation only need recurs once time and is more efficient.The matlab code for the formula is: erlang_b.m%*% File: erlanb_b.m % A = offered traffic in Erlangs. % n = nu

13、mber of truncked channels. % Pb is the result blocking probability. %*function Pb = erlang_b( A,n ) if n=0 Pb=1; % P(0,A)=1 else Pb=1/(1+n/(A*erlang_b(A,n-1); % use recursion erlang(A,n-1) endendAs we can see from the table on the text books, it uses the logarithm coordinate, so we also use the loga

14、rithm coordinate to plot the result. We divide the number of servers(n) into three parts, for each part we can define a interval of the traffic intensity(A) based on the figure on the text books : 1. when 0n10, 0.1A10.2. when 10n20, 3A20.3. when 30n100, 13Amin(serv_desk) state(3,i)=0; else state(3,i

15、)=min(serv_desk)-arr_time(i); %when customer NO.i arrives and the %server is all busy, the waiting time can be compute by %minus arriving time from the minimum leaving time end state(5,i)=sum(state(:,i); for j=1:server_num if serv_desk(j)=min(serv_desk) serv_desk(j)=state(5,i); break end %replace th

16、e minimum leaving time by the first waiting customers leaving time end end %second part: compute the queue length during the whole service interval% zero_time=0;%zero_time is used to identify which server is empty serv_desk(1:server_num)=zero_time; block_num=0; block_line=0; for i=1:peo_num if block

17、_line=0 find_max=0; for j=1:server_num if serv_desk(j)=zero_time find_max=1; %means there is empty server break else continue end end if find_max=1 %update serv_desk serv_desk(j)=state(5,i); for k=1:server_num if serv_desk(k)min(serv_desk) %if a customer will leave before the NO.i %customer arrive f

18、or k=1:server_num if arr_time(i)serv_desk(k) serv_desk(k)=state(5,i); break else continue end end for k=1:server_num if arr_time(i)serv_desk(k) serv_desk(k)=zero_time; else continue end end else %if no customer leave before the NO.i customer arrive block_num=block_num+1; block_line=block_line+1; end

19、 end else %the situation that the queue length is not zero n=0; %compute the number of leaing customer before the NO.i customer arrives for k=1:server_num if arr_time(i)serv_desk(k) n=n+1; serv_desk(k)=zero_time; else continue end end for k=1:block_line if arr_time(i)state(5,i-k) n=n+1; else continue end end if nblock_line+1 % nblock_line+1 means the queue length is still not zero block_num=block_num+1;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com