




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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 queueing theor
2、y 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 are randomly
3、 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 system's physical configuration, by specifying the number and arrangement of the servers
4、, 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 assumption ab
5、out 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 (i.e., M/
6、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 n is th
7、e 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 modelThe Erl
8、ang 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 formula,Whe
9、re =1 if A>n and =An if A<n. 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
14、use the logarithm 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 0<n<10, 0.1<A<10.2. when 10<n<20, 3<A<20.3. when 30<n<
15、;100, 13<A<120.For each part, use the “erlang_b” function to calculate and then use “l(fā)oglog” function to figure the logarithm coordinate.The matlab code is :%*% for the three parts.% n is the number servers.% A is the traffic indensity.% P is the blocking probability.%*n_1 = 1:2;A_1 = linspace
16、(0.1,10,50); % 50 points between 0.1 and 10.n_2 = 10:10:20;A_2 = linspace(3,20,50); n_3 = 30:10:100; A_3 = linspace(13,120,50); %*% for each part, call the erlang_b() function.%*for i = 1:length(n_1) for j = 1:length(A_1) p_1(j,i) = erlang_b(A_1(j),n_1(i); end end for i = 1:length(n_2) for j = 1:len
17、gth(A_2) p_2(j,i) = erlang_b(A_2(j),n_2(i); end end for i = 1:length(n_3) for j = 1:length(A_3) p_3(j,i) = erlang_b(A_3(j),n_3(i); end end %*% use loglog to figure the result within logarithm coordinate.%*loglog(A_1,p_1,'k-',A_2,p_2,'k-',A_3,p_3,'k-');xlabel('Traffic inde
18、nsity in Erlangs (A)') ylabel('Probability of Blocking (P)') axis(0.1 120 0.001 0.1) text(.115, .115,'n=1') text(.6, .115,'n=2') text(7, .115,'10') text(17, .115,'20') text(27, .115,'30') text(45, .115,'50') text(100, .115,'100') Th
19、e figure on the text books is as follow:We can see from the two pictures that, they are exactly the same with each other except that the result of the experiment have not considered the situation with n=3,4,5,12,14,16,18.2. Using the formula (1.4), calculate the blocking probability of the Erlang C
20、model. Draw the relationship of the blocking probability PC(n,A) and offered traffic A with n = 1,2, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100. From the introduction, we know that the formula 1.4 is : PCn,A=nPB(n,A)n-A(1-PB(n,A)Since each time we calculate the PBn,A, we need to recurs n times, so the
21、formula is not efficient. We change it to be: PCn,A=nPB(n,A)n-A(1-PB(n,A)=1n-A(1-PB(n,A)nPB(n,A)=1(An+n-AnPBn,A) Then we only need recurs once. PBn,A is calculated by the “erlang_b” function as step 1.The matlab code for the formula is : erlang_c.m%*% File: erlanb_b.m % A = offered traffic in Erlang
22、s. % n = number of truncked channels. % Pb is the result blocking probability. % erlang_b(A,n) is the function of step 1.%*function Pc = erlang_c( A,n ) Pc=1/(A/n)+(n-A)/(n*erlang_b(A,n);endThen to figure out the table in the logarithm coordinate as what shown in the step 1.The matlab code is :%*% f
23、or the three parts.% n is the number servers.% A is the traffic indensity.% P_c is the blocking probability of erlangC model.%*n_1 = 1:2;A_1 = linspace(0.1,10,50); % 50 points between 0.1 and 10.n_2 = 10:10:20;A_2 = linspace(3,20,50); n_3 = 30:10:100; A_3 = linspace(13,120,50); %*% for each part, ca
24、ll the erlang_c() function.%*for i = 1:length(n_1) for j = 1:length(A_1) p_1_c(j,i) = erlang_c(A_1(j),n_1(i); %µ÷Óú¯Êýerlang_c end end for i = 1:length(n_2) for j = 1:length(A_2) p_2_c(j,i) = erlang_c(A_2(j),n_2(i); end end for i = 1:length(n_3) for j = 1:len
25、gth(A_3) p_3_c(j,i) = erlang_c(A_3(j),n_3(i); end end %*% use loglog to figure the result within logarithm coordinate.%*loglog(A_1,p_1_c,'g*-',A_2,p_2_c,'g*-',A_3,p_3_c,'g*-');xlabel('Traffic indensity in Erlangs (A)') ylabel('Probability of Blocking (P)') axi
26、s(0.1 120 0.001 0.1) text(.115, .115,'n=1') text(.6, .115,'n=2') text(6, .115,'10') text(14, .115,'20') text(20, .115,'30') text(30, .115,'40')text(39, .115,'50') text(47, .115,'60')text(55, .115,'70')text(65, .115,'80')
27、text(75, .115,'90')text(85, .115,'100')The result of blocking probability table of erlang C model.Then we put the table of erlang B and erlang C in the one figure, to compare their characteristic. 10010-1The line with * is the erlang C model, the line without * is the erlang B model.
28、 We can see from the picture that, for a constant traffic intensity (A), the erlang C model has a higher blocking probability than erlang B model. The blocking probability is increasing with traffic intensity. The system performs better when has a larger n.ADDITIONAL BONUSWrite a program to simulate
29、 a M/M/k queue system with input parameters of lamda, mu, k.In this part, we will firstly simulate the M/M/k queue system use matlab to get the figure of the performance of the system such as the leave time of each customer and the queue length of the system.About the simulation, we firstly calculat
30、e the arrive time and the leave time for each customer. Then analysis out the queue length and the wait time for each customer use “for” loops. Then we let the input to be lamda = 3, mu = 1 and S = 3, and analysis performance of the system for the first 10 customers in detail. Finally, we will do tw
31、o test to compared the performance of the system with input lamda = 1, mu = 1 and S = 3 and the input lamda = 4, mu = 1 and S = 3.The matlab code is: mms_function.m functionblock_rate,use_rate=MMS_function(mean_arr,mean_serv,peo_num,server_num) %first part: compute the arriving time interval, servic
32、e time%interval,waiting time, leaving time during the whole service interval% state=zeros(5,peo_num); %represent the state of each customer by %using a 5*peo_num matrix %the meaning of each line is: arriving time interval, service time %interval, waiting time, queue length when NO.ncustomer %arrive,
33、 leaving timestate(1,:)=exprnd(1/mean_arr,1,peo_num); %arriving time interval between each %customer follows exponetial distributionstate(2,:)=exprnd(1/mean_serv,1,peo_num); %service time of each customer follows exponetial distributionfor i=1:server_num state(3,1:server_num)=0; end arr_time=cumsum(
34、state(1,:); %accumulate arriving time interval to compute %arriving time of each customerstate(1,:)=arr_time; state(5,1:server_num)=sum(state(:,1:server_num); %compute living time of first NO.server_num %customer by using fomular arriving time + service timeserv_desk=state(5,1:server_num); %create a
35、 vector to store leaving time of customers which is in servicefor i=(server_num+1):peo_num if arr_time(i)>min(serv_desk) state(3,i)=0; else state(3,i)=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
36、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 the minimum leaving time by the first waiting customer's leaving time end end %second part: compute the queue length during the whole service inte
37、rval% 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_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_m
38、ax=1 %update serv_desk serv_desk(j)=state(5,i); for k=1:server_num if serv_desk(k)<arr_time(i) %before the NO.i customer actually arrives there maybe some customer leave serv_desk(k)=zero_time; else continue end end else if arr_time(i)>min(serv_desk) %if a customer will leave before the NO.i %
39、customer arrive for 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; blo
40、ck_line=block_line+1; end 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)>
41、;state(5,i-k) n=n+1; else continue end end if n<block_line+1 % n<block_line+1 means the queue length is still not zero block_num=block_num+1; for k=0:n-1 if state(5,i-block_line+k)>arr_time(i) for m=1:server_num if serv_desk(m)=zero_time serv_desk(m)=state(5,i-block_line+k) break else conti
42、nue end end else continue end end block_line=block_line-n+1; else %n>=block_line+1 means the queue length is zero %update serv_desk and queue length for k=0:block_line if arr_time(i)<state(5,i-k) for m=1:server_num if serv_desk(m)=zero_time serv_desk(m)=state(5,i-k) break else continue end end
43、 else continue end end block_line=0; end end state(4,i)=block_line;end plot(state(1,:),'*-');figureplot(state(2,:),'g');figureplot(state(3,:),'r*');figureplot(state(4,:),'y*');figureplot(state(5,:),'*-'); Since the system is M/M/S which means the arriving rate
44、 and service rate follows Poisson distribution while the number of server is S and the buffer length is infinite, we can compute all the arriving time, service time, waiting time and leaving time of each customer. We can test the code with input lamda = 3, mu = 1 and S = 3. Figures are below.Arrivin
45、g time of each customerService time of each customerWaiting time of each customerQueue length when each customer arriveLeaving time of each customerAs lamda = mu*server_num, the load of the system could be very high.l Then we will zoom in the result pictures to analysis the performance of the system
46、 for the firstly 10 customer.The first customer enter the system at about 1s.Arriving time of first 10 customerThe queue length is 1 for the 7th customer.Queue length of first 10 customerThe second customer leaves the system at about 1.3sLeaving time of first 10 customer1. As we have 3 server in thi
47、s test, the first 3 customer will be served without any delay. 2. The arriving time of customer 4 is about 1.4 and the minimum leaving time of customer in service is about 1.2. So customer 4 will be served immediately and the queue length is still 0. 3. Customer 1, 4, 3 is in service.4. The arriving
48、 time of customer 5 is about 1.8 and the minimum leaving time of customer in service is about 1.6. So customer 5 will be served immediately and the queue length is still 0.5. Customer 1, 5 is in service.6. The arriving time of customer 6 is about 2.1 and there is a empty server. So customer 6 will be served immediately and the queue length is still 0.7. Customer 1, 5, 6 is in service.8. The arriving time of customer 7 is about 2.2 and the minimum leaving time of customer in service is about 2.5. So customer 7 cannot be served immediately and the queue length will be 1.9. Customer 1, 5, 6 is i
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030年藥品行業(yè)市場(chǎng)發(fā)展分析及發(fā)展趨勢(shì)與投資研究報(bào)告
- 2025-2030年電聲診斷儀器行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030年中國(guó)錘式破碎機(jī)行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030年中國(guó)重型輸送帶行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030年中國(guó)輕燃料油行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030年中國(guó)社會(huì)業(yè)務(wù)應(yīng)用行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 2025-2030年中國(guó)睡眠學(xué)習(xí)設(shè)備行業(yè)市場(chǎng)現(xiàn)狀供需分析及投資評(píng)估規(guī)劃分析研究報(bào)告
- 廣西質(zhì)量工程職業(yè)技術(shù)學(xué)院《植物病理學(xué)》2023-2024學(xué)年第二學(xué)期期末試卷
- 遼寧機(jī)電職業(yè)技術(shù)學(xué)院《商務(wù)策劃》2023-2024學(xué)年第二學(xué)期期末試卷
- 廣東職業(yè)技術(shù)學(xué)院《國(guó)際法前沿》2023-2024學(xué)年第二學(xué)期期末試卷
- 人力資源管理視角下崗位勝任力素質(zhì)模型的構(gòu)建與優(yōu)化
- 經(jīng)濟(jì)學(xué)中的時(shí)間價(jià)值試題及答案解讀
- 2024年湖北省竹山縣事業(yè)單位公開招聘名筆試題帶答案
- 員工持股協(xié)議書合同
- 酒館入股合同協(xié)議書
- 2025年人保財(cái)險(xiǎn)陜西省分公司招聘(57人)筆試參考題庫(kù)附帶答案詳解
- 民法典宣傳進(jìn)企業(yè)課件
- 基于核心素養(yǎng)下的高中數(shù)學(xué)情境教學(xué)研究
- 供熱企業(yè)安全管理制度
- 《阿里巴巴招聘案例》課件
- 應(yīng)聘索道面試題及答案
評(píng)論
0/150
提交評(píng)論