![單服務(wù)排隊(duì)系統(tǒng)MATLAB仿真程序_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/7/2f20771b-22d0-4d1a-8f79-22d1e7edcd12/2f20771b-22d0-4d1a-8f79-22d1e7edcd121.gif)
![單服務(wù)排隊(duì)系統(tǒng)MATLAB仿真程序_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/7/2f20771b-22d0-4d1a-8f79-22d1e7edcd12/2f20771b-22d0-4d1a-8f79-22d1e7edcd122.gif)
![單服務(wù)排隊(duì)系統(tǒng)MATLAB仿真程序_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/7/2f20771b-22d0-4d1a-8f79-22d1e7edcd12/2f20771b-22d0-4d1a-8f79-22d1e7edcd123.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、單服務(wù)臺(tái)系統(tǒng)MATLAB仿真學(xué)號(hào):15 姓名:繆晨一、引言排隊(duì)是日常生活中經(jīng)常遇到的現(xiàn)象。 通常,當(dāng)人、物體或是信息的到 達(dá)速率大于完成服務(wù)的速率時(shí),即出現(xiàn)排隊(duì)現(xiàn)象。排隊(duì)越長(zhǎng),意味著 浪費(fèi)的時(shí)間越多,系統(tǒng)的效率也越低。在日常生活中,經(jīng)常遇到排隊(duì) 現(xiàn)象,如開(kāi)車上班、在超市等待結(jié)賬、工廠中等待加工的工件以及待 修的機(jī)器等??傊抨?duì)現(xiàn)象是隨處可見(jiàn)的。排隊(duì)理論是運(yùn)作管理中 最重要的領(lǐng)域之一,它是計(jì)劃、工作設(shè)計(jì)、存貨控制及其他一些問(wèn)題 的基礎(chǔ)。Matlab是MathWorks公司開(kāi)發(fā)的科學(xué)計(jì)算軟件,它以其強(qiáng) 大的計(jì)算和繪圖功能、大量穩(wěn)定可靠的算法庫(kù)、簡(jiǎn)潔高效的編程語(yǔ)言 以及龐大的用戶群成為數(shù)學(xué)計(jì)算工具
2、方面的標(biāo)準(zhǔn),幾乎所有的工程計(jì)算領(lǐng)域,Matlab都有相應(yīng)的軟件工具箱。選用Matlab軟件正是基 于Matlab的諸多優(yōu)點(diǎn)。排隊(duì)模型三. 仿真算法原理(1)顧客信息初始化根據(jù)到達(dá)率入 和服務(wù)率來(lái)確定每個(gè)顧客的到達(dá)時(shí)間間隔和服 務(wù)時(shí)間間隔。服務(wù)間隔時(shí)間可以用負(fù)指數(shù)分布函數(shù) exprnd()來(lái)生成 由于泊松過(guò)程的時(shí)間間隔也服從負(fù)指數(shù)分布,故亦可由此函數(shù)生成 顧客到達(dá)時(shí)間間隔 。需要注意的是 exprnd() 的輸入?yún)?shù)不是到達(dá)率 入和服務(wù)率口而是平均到達(dá)時(shí)間間隔1/入和平均服務(wù)時(shí)間1/卩。根據(jù)到達(dá)時(shí)間間隔 , 確定每個(gè)顧客的到達(dá)時(shí)刻 . 學(xué)習(xí)過(guò) C 語(yǔ)言 的人習(xí)慣于使用FOR循環(huán)來(lái)實(shí)現(xiàn)數(shù)值的累加,
3、但FOR循環(huán)會(huì)引起運(yùn) 算復(fù)雜度的增加 而在MATLAB仿真環(huán)境中,提供了一個(gè)方便的函數(shù) cumsum() 來(lái)實(shí)現(xiàn)累加功能 讀者可以直接引用對(duì)當(dāng)前顧客進(jìn)行初始化。 第 1 個(gè)到達(dá)系統(tǒng)的顧客不需要等待就 可以直接接受服務(wù) 其離開(kāi)時(shí)刻等于到達(dá)時(shí)刻與服務(wù)時(shí)間之和。(2)進(jìn)隊(duì)出隊(duì)仿真在當(dāng)前顧客到達(dá)時(shí)刻, 根據(jù)系統(tǒng)內(nèi)已有的顧客數(shù)來(lái)確定是否接納 該顧客。 若接納 則根據(jù)前一顧客的離開(kāi)時(shí)刻來(lái)確定當(dāng)前顧客的等待 時(shí)間 、離開(kāi)時(shí)間和標(biāo)志位 ;若拒絕, 則標(biāo)志位置為 0.流程圖如下:訃牛K容的離開(kāi)時(shí)i=2N箍工樸按渝、第i牛嗾窖? ”/林*kfifKmAi+I1*1 MSfii節(jié)操客的VWHM.育開(kāi)時(shí)訶、標(biāo)志位;四
4、、程序?qū)崿F(xiàn)單服務(wù)臺(tái)服務(wù),服務(wù)參數(shù) M/M/1,入二卩二,排隊(duì)規(guī)則為FIFO,以 分為單位,仿真時(shí)間240分鐘。仿真程序代碼如下%總仿真時(shí)間Total_time = 240;%到達(dá)率與服務(wù)率 lambda =;mu =;%平均到達(dá)時(shí)間與平均服務(wù)時(shí)間 arr_mean = 1/lambda;ser_mean = 1/mu;%可能到達(dá)的最大顧客數(shù)( round :四舍五入求整數(shù)) arr_num = round(Total_time*lambda*2);%顧客事件表初始化events = ;%按負(fù)指數(shù)分布產(chǎn)生各顧客達(dá)到時(shí)間間隔events(1,:) = exprnd(arr_mean,1,arr_n
5、um);%各顧客的到達(dá)時(shí)刻等于時(shí)間間隔的累積和events(1,:) = cumsum(events(1,:);%按負(fù)指數(shù)分布產(chǎn)生各顧客服務(wù)時(shí)間events(2,:) = exprnd(ser_mean,1,arr_num); %計(jì)算仿真顧客個(gè)數(shù),即到達(dá)時(shí)刻在仿真時(shí)間內(nèi)的顧客數(shù) len_sim = sum(events(1,:)Total_timebreak;%如果第 i 個(gè)顧客的到達(dá)時(shí)間未超過(guò)仿真時(shí)間,則計(jì)算在其 %到達(dá)時(shí)刻系統(tǒng)中已有的顧客個(gè)數(shù)else number = sum(events(4,member) events(1,i);%如果系統(tǒng)已滿,則系統(tǒng)拒絕第 i 個(gè)顧客,其標(biāo)志位置 0
6、 if number = N+1events(5,i) = 0;%如果系統(tǒng)為空,則第 i 個(gè)顧客直接接受服務(wù) else if number = 0%其等待時(shí)間為 0 events(3,i) = 0;%其離開(kāi)時(shí)刻等于到達(dá)時(shí)刻與服務(wù)時(shí)間之和 events(4,i) = events(1,i)+events(2,i);%其標(biāo)志位置 1events(5,i) = 1;member = member,i;%如果系統(tǒng)有顧客正在接受服務(wù),且系統(tǒng)等待隊(duì)列未滿,則%第 i 個(gè)顧客進(jìn)入系統(tǒng)else len_mem = length(member);%其等待時(shí)間等于隊(duì)列中前一個(gè)顧客的離開(kāi)時(shí)刻減去其到%達(dá)時(shí)刻even
7、ts(3,i)=events(4,member(len_mem)-events(1,i);%其離開(kāi)時(shí)刻等于隊(duì)列中前一個(gè)顧客的離開(kāi)時(shí)刻加上其服 %務(wù)時(shí)間 events(4,i)=events(4,member(len_mem)+events(2,i);%標(biāo)識(shí)位表示其進(jìn)入系統(tǒng)后,系統(tǒng)內(nèi)共有的顧客數(shù) events(5,i) = number+1;member = member,i;endendendend五、仿真結(jié)果events =number =1number =0events =Columns1 through 7000000 0000 000000 0000000000000015 throu
8、gh 21000000000000Columns8 through1400 000 000 0Columns00 000 000 0Columns22 through 280 0 00 0 000 000 000 00 0 00 0 00 0 000 000 000 0Columns 29 through 35Columns 36 through 420 0 00 00 0000Columns 43 through 48000000000000000000events =Columns1 through 70000000000 0000000000000015 through 21000000
9、000000Columns8 through1400 000 000 0Columns00 000 000 0Columns22 through 280 0 00 0 000 000 000 00 0 00 0 00 0 0Columns 36 through 4200 000 000 0Columns 29 through 3500000 000000 0Columns 43 through48000000 0 00 0 00 0 0number =1 number =events =Columns 1 through 70 00000 00 0 0 000 0 0 00Columns 8
10、through 1400000000000000000000 0Columns 15 through 210 0 00 0 000 000 000 00 0 00 0 00 0 0Columns 29 through 350 0 000 000 000 0Columns 22 through 280 0 00 0Columns 36 through 4200 000 000 00 0 00 0 00 0 0Columns 43 through 480000 0 00 0 00events =Columns 1 through 7000000 00 00 00 00 0Columns 8 thr
11、ough1400000000000000000000 0Columns 15 through 210 0 00 0 000 000 000 00 0 00 0 00 0 0Columns 29 through 3500 000 000 0Columns 22 through 2800 000 00 0 0Columns 36 through 4200 000 000 00 0 00 0 00 0 0Columns 43 through 480 0 00 0 0number =1number =1number =0events =Columns 1 through7000000 00 00000
12、000000000015 through 21000000000000Columns8 through1400 000 000 0Columns00 000 000 0Columns22 through 280 0 00 0 000 000 000 00 0 00 0 00 0 000 000 000 0Columns 29 through 35Columns 36 through 420 0 00 00 0000Columns 43 through 48000000000000000000events =Columns1 through 70000000000 0000 0Columns 8
13、 through 140 0 00 0 0 000 0 0 0Columns 15 through 210 00 00 00 00 00 00 0 00 0 00 0 0Columns 22 through 280 0 00 0 000 000 000 0Columns 29 through 3500 000 000 00 0 00 0 00 0 0Columns 36 through 4200000 000000 0Columns 43 through480 000 000 00 0 00 0 00 0 0number =1 number =number = events =Columns1
14、 through7000000 0000 0000 0Columns8 through14000000000000000000Columns15through2100 000 000 0Columns00 000 000 0Columns00000000000022 through 2800000000000029 through 350 0 00 0 000 000 000 0Columns 36 through 4200 000 000 00 0 00 0 00 0 0Columns 43 through 480 0 000 00000events =Columns 1 through 7
15、000000 00 00 00 00 0Columns 8 through1400 00000000 0 0000 0 0Columns 15 through 210 0 00 0 000 000 000 00 0 00 0 00 0 000 000 000 0Columns 22 through 28Columns 29 through 3500 000 000 00 0 00 0 00 0 00 0000000 0000000 0Columns 36 through42Columns 43 through 480 0 00number =1number =0events =Columns
16、1 through 70 0 00 00 0 0 00 0 0 0Columns 8 through 14000 00 0000 00 0Columns 15 through21000 0 000000000000 00 0 00 0 0Columns 22 through 280 0 0 0 0 00 0 0 0 0 00 0 0 0Columns 29 through 3500 000 000 00 0 00 0 00 0 0Columns 36 through 420 00 00 00 00 00 0Columns 43 through 480 0 00 0 00 0 000000000
17、0events =Columns1 through7000 0000 0000 0Columns8 through14000 0 00 0 00 0 00 00 0 0 00 0 0 0Columns 15 through 210000000000000 0 00 0 00 0 00 0 0Columns 22 through 2800 00 0 000 00Columns29through3500 000 000 0Columns00 000 000 0Columns00000000000036 through 4200000000000043 through 480000000000000
18、00000number =1number =0events =Columns1 through 70 0 0Columns8 through14000000 000 00000 0Columns15 through21000000000000000000000Columns 22 through 280 0 00 0 000 000 000 00 0 00 0 00 0 000 000 000 0Columns 29 through 35Columns 36 through 420 0 00 00 0000Columns 43 through 48000000000000000000events =Columns1 through 70000000000 0000 0Columns 8 through 140 0 00 0 0 00 0 0 0Columns 15 through 210 0 0 0 0 00 0 0 0 0Columns 22 through 28000000 0000000 0Columns 29 through3500 000 000 00 0
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 【正版授權(quán)】 ISO/IEC TS 7339:2024 EN Information technology - Cloud computing - Overview of platform capabilities type and platform as a service
- 【正版授權(quán)】 ISO 37111:2024 EN Sustainable cities and communities - Urban settlements - Guidance for a flexible approach to phased implementation of ISO 37101
- 2025年度大清包勞務(wù)合同(市政道路施工管理協(xié)議)
- 2025年度廢鐵進(jìn)出口代理與運(yùn)輸服務(wù)合同
- 2025年度科技展會(huì)場(chǎng)地布置及維護(hù)服務(wù)合同
- 2025年起動(dòng)腳蹬桿項(xiàng)目建議書
- 2025年超低頻振動(dòng)標(biāo)準(zhǔn)合作協(xié)議書
- 多元化教學(xué)方法實(shí)施方案計(jì)劃
- 倉(cāng)庫(kù)工作總結(jié)計(jì)劃指引
- 社會(huì)媒體策略的實(shí)踐與回顧計(jì)劃
- 服飾品設(shè)計(jì)PPT完整全套教學(xué)課件
- 2023年04月廣東深圳市市場(chǎng)監(jiān)督管理局許可審查中心招考聘用醫(yī)療器械注冊(cè)審評(píng)員(員額)筆試參考題庫(kù)附答案解析
- 小學(xué)六年級(jí)數(shù)學(xué)計(jì)算題100道(含答案)
- 室外工程小市政監(jiān)理實(shí)施細(xì)則
- 我的妹妹-教學(xué)設(shè)計(jì)教案
- GB/T 881-2000螺尾錐銷
- GB/T 30512-2014汽車禁用物質(zhì)要求
- GB/T 21117-2007磁致伸縮液位計(jì)
- 五年級(jí)上冊(cè)語(yǔ)文閱讀理解附答案
- 水帶業(yè)務(wù)操作規(guī)范一人兩帶
- 2023執(zhí)業(yè)藥師繼續(xù)教育試題題庫(kù)和答案(完整版)
評(píng)論
0/150
提交評(píng)論