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

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

WirelessNetworkExperimentThree:QueuingTheoryABSTRACTThisexperimentisdesignedtolearnthefundamentalsofthequeuingtheory.MainlyabouttheM/M/SandM/M/n/nqueuingmodels.KEYWORDS:queuingtheory,M/M/s,M/M/n/n,ErlangB,ErlangC.INTRODUCTIONAqueueisawaitinglineandqueueingtheoryisthemathematicaltheoryofwaitinglines.Moregenerally,queueingtheoryisconcernedwiththemathematicalmodelingandanalysisofsystemsthatprovideservicetorandomdemands.Incommunicationnetworks,queuesareencounteredeverywhere.Forexample,theincomingdatapacketsarerandomlyarrivedandbuffered,waitingfortheroutertodeliver.Suchsituationisconsideredasaqueue.Aqueueingmodelisanabstractdescriptionofsuchasystem.Typically,aqueueingmodelrepresents(1)thesystem'sphysicalconfiguration,byspecifyingthenumberandarrangementoftheservers,and(2)thestochasticnatureofthedemands,byspecifyingthevariabilityinthearrivalprocessandintheserviceprocess.Theessenceofqueueingtheoryisthatittakesintoaccounttherandomnessofthearrivalprocessandtherandomnessoftheserviceprocess.ThemostcommonassumptionaboutthearrivalprocessisthatthecustomerarrivalsfollowaPoissonprocess,wherethetimesbetweenarrivalsareexponentiallydistributed.Theprobabilityoftheexponentialdistributionfunctionisf(t)=λe−λt.ErlangBmodelOneofthemostimportantqueueingmodelsistheErlangBmodel(i.e.,M/M/n/n).ItassumesthatthearrivalsfollowaPoissonprocessandhaveafinitenservers.InErlangBmodel,itassumesthatthearrivalcustomersareblockedandclearedwhenalltheserversarebusy.TheblockedprobabilityofaErlangBmodelisgivenbythefamousErlangBformula,wherenisthenumberofserversandA=λ/μistheofferedloadinErlangs,λisthearrivalrateand1/μistheaverageservicetime.Formula(1.1)ishardtocalculatedirectlyfromitsrightsidewhennandAarelarge.However,itiseasytocalculateitusingthefollowingiterativescheme:ErlangCmodelTheErlangdelaymodel(M/M/n)issimilartoErlangBmodel,exceptthatnowitassumesthatthearrivalcustomersarewaitinginaqueueforaservertobecomeavailablewithoutconsideringthelengthofthequeue.Theprobabilityofblocking(alltheserversarebusy)isgivenbytheErlangCformula,Whereρ=1ifA𝑛andρ=AnifA𝑛.Thequantityρindicatestheserverutilization.TheErlangCformula(1.3)canbeeasilycalculatedbythefollowingiterativeschemewherePB(n,A)isdefinedinEq.(1.1).DESCRIPTIONOFTHEEXPERIMENTS1.Usingtheformula(1.2),calculatetheblockingprobabilityoftheErlangBmodel.DrawtherelationshipoftheblockingprobabilityPB(n,A)andofferedtrafficAwithn=1,2,10,20,30,40,50,60,70,80,90,100.Compareitwiththetableinthetextbook(P.281,table10.3).Fromtheintroduction,weknowthatwhenthenandAarelarge,itiseasytocalculatetheblockingprobabilityusingtheformula1.2asfollows.PB(n,A)=APB(n−1,A)m+APB(n−1,A)itusethetheoryofrecursionforthecalculation.Butthedenominatorandthenumeratoroftheformulabothneedtorecurs(PB(n−1,A))whendoingthematlabcalculation,itwastetimeandreducethematlabcalculationefficient.Sowechangetheformulatobe:PB(n,A)=APB(n−1,A)n+APB(n−1,A)=1n+APB(n−1,A)APB(n−1,A)=1(1+𝑛APB(n−1,A))⁄Thenthecalculationonlyneedrecursoncetimeandismoreefficient.Thematlabcodefortheformulais:erlang_b.m%**************************************%File:erlanb_b.m%A=offeredtrafficinErlangs.%n=numberoftrunckedchannels.%Pbistheresultblockingprobability.%**************************************function[Pb]=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,sowealsousethelogarithmcoordinatetoplottheresult.Wedividethenumberofservers(n)intothreeparts,foreachpartwecandefineaintervalofthetrafficintensity(A)basedonthefigureonthetextbooks:1.when0n10,0.1A10.2.when10n20,3A20.3.when30n100,13A120.Foreachpart,usethe“erlang_b”functiontocalculateandthenuse“loglog”functiontofigurethelogarithmcoordinate.Thematlabcodeis:%*****************************************%forthethreeparts.%nisthenumberservers.%Aisthetrafficindensity.%Pistheblockingprobability.%*****************************************n_1=[1:2];A_1=linspace(0.1,10,50);%50pointsbetween0.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_b()function.%*****************************************fori=1:length(n_1)forj=1:length(A_1)p_1(j,i)=erlang_b(A_1(j),n_1(i));endendfori=1:length(n_2)forj=1:length(A_2)p_2(j,i)=erlang_b(A_2(j),n_2(i));endendfori=1:length(n_3)forj=1:length(A_3)p_3(j,i)=erlang_b(A_3(j),n_3(i));endend%*****************************************%useloglogtofiguretheresultwithinlogarithmcoordinate.%*****************************************loglog(A_1,p_1,'k-',A_2,p_2,'k-',A_3,p_3,'k-');xlabel('TrafficindensityinErlangs(A)')ylabel('ProbabilityofBlocking(P)')axis([0.11200.0010.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')Thefigureonthetextbooksisasfollow:Wecanseefromthetwopicturesthat,theyareexactlythesamewitheachotherexceptthattheresultoftheexperimenthavenotconsideredthesituationwithn=3,4,5,…,12,14,16,18.2.Usingtheformula(1.4),ca

1 / 21
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功