版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、WirelessNetworkExperimentThree:QueuingTheoryABSTRACTThisexperimentisdesignedtolearnthefundamentalsofthequeuingtheory.MainlyabouttheM/M/SandM/M/n/nqueuingmodels.KEYWORDS:queuingtheory,M/M/s,M/M/n/n,ErlangB,ErlangC.INTRODUCTIONAqueueisawaitinglineandqueueingtheoryisthemathematicaltheoryofwaitinglines.
2、Moregenerally,queueingtheoryisconcernedwiththemathematicalmodelingandanalysisofsystemsthatprovideservicetorandomdemands.Incommunicationnetworks,queuesareencounteredeverywhere.Forexample,theincomingdatapacketsarerandomlyarrivedandbuffered,waitingfortheroutertodeliver.Suchsituationisconsideredasaqueue
3、.Aqueueingmodelisanabstractdescriptionofsuchasystem.Typically,aqueueingmodelrepresents(1)thesystemsphysicalconfiguration,byspecifyingthenumberandarrangementoftheservers,and(2)thestochasticnatureofthedemands,byspecifyingthevariabilityinthearrivalprocessandintheserviceprocess.Theessenceofqueueingtheor
4、yisthatittakesintoaccounttherandomnessofthearrivalprocessandtherandomnessoftheserviceprocess.ThemostcommonassumptionaboutthearrivalprocessisthatthecustomerarrivalsfollowaPoissonprocess,wherethetimesbetweenarrivalsareexponentiallydistributed.Theprobabilityoftheexponentialdistributionfunctionisf(t)=入e
5、入t.ErlangBmodelOneofthemostimportantqueueingmodelsistheErlangBmodel(i.e.,M/M/n/n).ItassumesthatthearrivalsfollowaPoissonprocessandhaveafinitenservers.InErlangBmodel,itassumesthatthearrivalcustomersareblockedandclearedwhenalltheserversarebusy.TheblockedprobabilityofaErlangBmodelisgivenbythefamousErla
6、ngBformula,(I)PE(n3=,蛙、2k=i)kTwherenisthenumberofserversandA=A/istheofferedloadinErlangs,入isthearrivalrateand1/p.istheaverageservicetime.Formula(1.1)ishardtocalculatedirectlyfromitsrightsidewhennandAarelarge.However,itiseasytocalculateitusingthefollowingiterativescheme:ErlangCmodelTheErlangdelaymode
7、l(M/M/n)issimilartoErlangBmodel,exceptthatnowitassumesthatthearrivalcustomersarewaitinginaqueueforaservertobecomeavailablewithoutconsideringthelengthofthequeue.Theprobabilityofblocking(alltheserversarebusy)isgivenbytheErlangCformula,Wherep=1ifAnandp=AifAn.Thequantitypindicatestheserverutilization.nT
8、heErlangCformula(1.3)canbeeasilycalculatedbythefollowingiterativeschemewhereP(n,A)isdefinedinEq.(1.1).BDESCRIPTIONOFTHEEXPERIMENTSUsingtheformula(1.2),calculatetheblockingprobabilityoftheErlangBmodel.DrawtherelationshipoftheblockingprobabilityPB(n,A)andofferedtrafficAwithn=1,2,10,20,30,40,50,60,70,8
9、0,90,100.Compareitwiththetableinthetextbook(P.281,table10.3).Fromtheintroduction,weknowthatwhenthenandAarelarge,itiseasytocalculatetheblockingprobabilityusingtheformula1.2asfollows.P(n,A)=APB(n_Bm+APB(n-1,A)itusethetheoryofrecursionforthecalculation.Butthedenominatorandthenumeratoroftheformulabothne
10、edtorecurs(PB(n-1,A)whendoingthematlabcalculation,itwastetimeandreducethematlabcalculationefficient.Sowechangetheformulatobe:PB(n,A)=APPB(n,A)=APB(n1,A)nAPb(n1,A)1=1/(12nAPB(n_1AAPB(nAPB(n-1,A)1,A)Thenthecalculationonlyneedrecursoncetimeandismoreefficient.Thematlabcodefortheformulais:erlang_b.m%*%Fi
11、le:erlanb_b.m%A=offeredtrafficinErlangs.%n=numberoftrunckedchannels.%Pbistheresultblockingprobability.%*functionPb=erlang_b(A,n)ifn=0Pb=1;%P(0,A)=1elsePb=1/(1+n/(A*erlang_b(A,n-1);%userecursionerlang(A,n-1)endendAswecanseefromthetableonthetextbooks,itusesthelogarithmcoordinate,sowealsousethelogarith
12、mcoordinatetoplottheresult.Wedividethenumberofservers(n)intothreeparts,foreachpartwecandefineaintervalofthetrafficintensity(A)basedonthefigureonthetextbooks:1.when0n10,0.1A10.when10n20,3A20.when30n100,13A*rofTrunkdClia-Hntla(C13I4?tAnM-MiLBSM10.0血0.01-TrafficlEueniiEyisBrito*Nwal*rofTrunkdClia-Hntla
13、(C13I4?tAnM-MiLBSM10.0血0.01-TrafficlEueniiEyisBrito*Wecanseefromthetwopicturesthat,theyareexactlythesamewitheachotherexceptthattheresultoftheexperimenthavenotconsideredthesituationwithn=3,4,5,.,12,14,16,18.2.Usingtheformula(1.4),calculatetheblockingprobabilityoftheErlangCmodel.Drawtherelationshipoft
14、heblockingprobabilityPC(n,A)andofferedtrafficAwithn=1,2,10,20,30,40,50,60,70,80,90,100.Fromtheintroduction,weknowthattheformula1.4is:PCPC(n,A)=nPB(n,A)n-A(1-PB(n,A)SinceeachtimewecalculatetheP(n,A),weneedtorecursntimes,sotheformulaisnotBefficient.Wechangeittobe:PC(n,A)=nPB(n,A)n-A(1-pB(n,A)=1/n_A(1_
15、PB(n,A)PC(n,A)=nPB(n,A)n-A(1-pB(n,A)Thenweonlyneedrecursonce.PB(n,A)iscalculatedbythe“erlang_b”functionasstep1.Thematlabcodefortheformulais:erlang_c.m%*%File:erlanb_b.m%A=offeredtrafficinErlangs.%n=numberoftrunckedchannels.%Pbistheresultblockingprobability.%erlang_b(A,n)isthefunctionofstep1.%*functi
16、onPc=erlang_c(A,n)Pc=1/(A/n)+(n-A)/(n*erlang_b(A,n);endThentofigureoutthetableinthelogarithmcoordinateaswhatshowninthestep1.Thematlabcodeis:%*%forthethreeparts.%nisthenumberservers.%Aisthetrafficindensity.%P_cistheblockingprobabilityoferlangCmodel.%*n_1=1:2;A_1=linspace(0.1,10,50);%50pointsbetween0.
17、1and10.n_2=10:10:20;A_2=linspace(3,20,50);n_3=30:10:100;A_3=linspace(13,120,50);%*%foreachpart,calltheerlang_c()function.%*fori=1:length(n_1)forj=1:length(A_1)p_1_c(j,i)=erlang_c(A_1(j),n_1(i);%pOA_Eyerlang_cendendfori=1:length(n_2)forj=1:length(A_2)p_2_c(j,i)=erlang_c(A_2(j),n_2(i);endendfori=1:len
18、gth(n_3)forj=1:length(A_3)p_3_c(j,i)=erlang_c(A_3(j),n_3(i);endend%*%useloglogtofiguretheresultwithinlogarithmcoordinate.%*loglog(A_1,p_1_c,g*-,A_2,p_2_c,g*-,A_3,p_3_c,g*-);xlabel(TrafficindensityinErlangs(A)ylabel(ProbabilityofBlocking(P)axis(0.11200.0010.1)text(.115,.115,n=1)text(.6,.115,n=2)text(
19、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)text(75,.115,90)text(85,.115,100)TheresultofblockingprobabilitytableoferlangCmodel.EBu住星口右xi-KFqaEBu住星口右xi-KFqa在ThenweputthetableoferlangBanderlangCintheonefigure,tocomparetheirc
20、haracteristic.E盂口in苫JTE盂口in苫JTiH-gqEd1D1io1Tr-sffic-ndensrlyinErbrig!炉iIfl3Thematlabcodeis:Thematlabcodeis:mms_function.mid1id1a1icrTraficindensfcyinErl-angsThelinewith*istheerlangCmodel,thelinewithout*istheerlangBmodel.Wecanseefromthepicturethat,foraconstanttrafficintensity(A),theerlangCmodelhasahi
21、gherblockingprobabilitythanerlangBmodel.Theblockingprobabilityisincreasingwithtrafficintensity.Thesystemperformsbetterwhenhasalargern.ADDITIONALBONUSWriteaprogramtosimulateaM/M/kqueuesystemwithinputparametersoflamda,mu,k.Inthispart,wewillfirstlysimulatetheM/M/kqueuesystemusematlabtogetthefigureofthe
22、performanceofthesystemsuchastheleavetimeofeachcustomerandthequeuelengthofthesystem.Aboutthesimulation,wefirstlycalculatethearrivetimeandtheleavetimeforeachcustomer.Thenanalysisoutthequeuelengthandthewaittimeforeachcustomeruse“for”loops.Thenwelettheinputtobelamda=3,mu=1andS=3,andanalysisperformanceof
23、thesystemforthefirst10customersindetail.Finally,wewilldotwotesttocomparedtheperformanceofthesystemwithinputlamda=1,mu=1andS=3andtheinputlamda=4,mu=1andS=3.functionblock_rate,use_rate=MMS_function(mean_arr,mean_serv,peo_num,server_num)%firstpart:computethearrivingtimeinterval,servicetime%interval,wai
24、tingtime,leavingtimeduringthewholeserviceinterval%state=zeros(5,peo_num);%representthestateofeachcustomerby%usinga5*peo_nummatrix%themeaningofeachlineis:arrivingtimeinterval,servicetime%interval,waitingtime,queuelengthwhenNO.ncustomer%arrive,leavingtimestate(1,:)=exprnd(1/mean_arr,1,peo_num);%arrivi
25、ngtimeintervalbetweeneach%customerfollowsexponetialdistributionstate(2,:)=exprnd(1/mean_serv,1,peo_num);%servicetimeofeachcustomerfollowsexponetialdistributionfori=1:server_numstate(3,1:server_num)=0;endarr_time=cumsum(state(1,:);%accumulatearrivingtimeintervaltocompute%arrivingtimeofeachcustomersta
26、te(1,:)=arr_time;state(5,1:server_num)=sum(state(:,1:server_num);%computelivingtimeoffirstNO.server_num%customerbyusingfomulararrivingtime+servicetimeserv_desk=state(5,1:server_num);%createavectortostoreleavingtimeofcustomerswhichisinservicefori=(server_num+1):peo_numifarr_time(i)min(serv_desk)state
27、(3,i)=0;elsestate(3,i)=min(serv_desk)-arr_time(i);%whencustomerNO.iarrivesandthe%serverisallbusy,thewaitingtimecanbecomputeby%minusarrivingtimefromtheminimumleavingtimeendstate(5,i)=sum(state(:,i);forj=1:server_numifserv_desk(j)=min(serv_desk)serv_desk(j)=state(5,i);breakend%replacetheminimumleaving
28、timebythefirstwaitingcustomersleavingtimeendend%secondpart:computethequeuelengthduringthewholeserviceinterval%zero_time=0;%zero_timeisusedtoidentifywhichserverisemptyserv_desk(1:server_num)=zero_time;block_num=0;block_line=0;fori=1:peo_numifblock_line=0find_max=0;forj=1:server_numifserv_desk(j)=zero
29、_timefind_max=1;%meansthereisemptyserverbreakelsecontinueendendiffind_max=1%updateserv_deskserv_desk(j)=state(5,i);fork=1:server_numifserv_desk(k)min(serv_desk)%ifacustomerwillleavebeforetheNO.i%customerarrivefork=1:server_numifarr_time(i)serv_desk(k)serv_desk(k)=state(5,i);breakelsecontinueendendfo
30、rk=1:server_numifarr_time(i)serv_desk(k)serv_desk(k)=zero_time;elsecontinueendendelse%ifnocustomerleavebeforetheNO.icustomerarriveblock_num=block_num+1;block_line=block_line+1;endendelse%thesituationthatthequeuelengthisnotzeron=0;%computethenumberofleaingcustomerbeforetheNO.icustomerarrivesfork=1:se
31、rver_numifarr_time(i)serv_desk(k)n=n+1;serv_desk(k)=zero_time;elsecontinueendendfork=1:block_lineifarr_time(i)state(5,i-k)n=n+1;elsecontinueendendifnblock_line+1%narr_time(i)form=1:server_numifserv_desk(m)=zero_timeserv_desk(m)=state(5,i-block_line+k)breakelsecontinueendendelsecontinueendendblock_li
32、ne=block_line-n+1;else%n=block_line+1meansthequeuelengthiszero%updateserv_deskandqueuelengthfork=0:block_lineifarr_time(i)state(5,i-k)form=1:server_numifserv_desk(m)=zero_timeserv_desk(m)=state(5,i-k)breakelsecontinueendendelsecontinueendendblock_line=0;endendstate(4,i)=block_line;endplot(state(1,:)
33、,*-);figureplot(state(2,:),g);figureplot(state(3,:),r*);figureplot(state(4,:),y*);figureplot(state(5,:),*-);SincethesystemisM/M/SwhichmeansthearrivingrateandserviceratefollowsPoissondistributionwhilethenumberofserverisSandthebufferlengthisinfinite,wecancomputeallthearrivingtime,servicetime,waitingti
34、meandleavingtimeofeachcustomer.Wecantestthecodewithinputlamda=3,mu=1andS=3.Figuresarebelow.Arrivingtimeofeachcustomercu-stamarnurnbar3DSD1D0ServicetimeofeachcustomerWaitingtimeofeachcustomer108?oQueuelengthwheneachcustomerarriveAslamda=mu*server_num,theloadofthesystemcouldbeveryhigh.Thenwewillzoomin
35、theresultpicturestoanalysistheperformanceofthesystemforthefirstly10customer.Arrivingtimeoffirst10customer1a=1.6-Thequeuelengthis1forthe7thcustomer.11a=1.6-Thequeuelengthis1forthe7thcustomer.1.卫-12345673910customBrrtuniberQueuelengthoffirst10customermELe.e=-bh_-u1234567mELe.e=-bh_-u1234567B510cuetoiT
36、i&rhurriberLeavingtimeoffirst10customerAswehave3serverinthistest,thefirst3customerwillbeservedwithoutanydelay.Thearrivingtimeofcustomer4isabout1.4andtheminimumleavingtimeofcustomerinserviceisabout1.2.Socustomer4willbeservedimmediatelyandthequeuelengthisstill0.Customer1,4,3isinservice.Thearrivingtime
37、ofcustomer5isabout1.8andtheminimumleavingtimeofcustomerinserviceisabout1.6.Socustomer5willbeservedimmediatelyandthequeuelengthisstill0.Customer1,5isinservice.Thearrivingtimeofcustomer6isabout2.1andthereisaemptyserver.Socustomer6willbeservedimmediatelyandthequeuelengthisstill0.Customer1,5,6isinservic
38、e.Thearrivingtimeofcustomer7isabout2.2andtheminimumleavingtimeofcustomerinserviceisabout2.5.Socustomer7cannotbeservedimmediatelyandthequeuelengthwillbe1.Customer1,5,6isinserviceandcustomer7iswaiting.Thearrivingtimeofcustomer8isabout2.4andtheminimumleavingtimeofcustomerinserviceisabout2.5.Socustomer8cannotbeservedimmediatelyandthe
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 收费站员工仪容仪表培训
- 西南交通大学《空间透视与建筑线描艺术》2022-2023学年第一学期期末试卷
- 西华师范大学《精微素描》2023-2024学年第一学期期末试卷
- 小肠回纳术手术配合
- 2024年01月11026经济学(本)期末试题答案
- DB32-T 4679-2024 生活垃圾焚烧发电厂烟气排放过程(工况)自动监控系统技术规范
- 西安邮电大学《艺术人才创业指导》2021-2022学年第一学期期末试卷
- 化学键 化学反应规律 说课标课件 2024-2025学年高一下学期化学鲁科版(2019)必修第二册
- 安居工程建设项目可行性研究报告
- 智研咨询-2025年中国金属船舶制造行业市场全景调查、投资策略研究报告
- 2024年度事业单位招聘考试计算机基础知识复习题库及答案(共800题)
- 大数据可视化智慧树知到期末考试答案章节答案2024年浙江大学
- 2023年基层卫生岗位练兵和技能竞赛试题及答案全科医疗组
- 卡拉瓦乔课件
- 办公设备维修工考试试题库与答案
- (完整版)小学五年级英语语法知识汇总
- 《创业计划书路演》PPT课件.ppt
- 【发酵工程】余龙江版 第11章 发酵产物的分离纯化
- 双色爆闪灯设计
- ★CCC内审检查表
- 造价咨询服务回访制度
评论
0/150
提交评论