版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、单服务台系统MATLAB仿真学号:15 姓名:缪晨一、引言排队是日常生活中经常遇到的现象。 通常,当人、物体或是信息的到 达速率大于完成服务的速率时,即出现排队现象。排队越长,意味着 浪费的时间越多,系统的效率也越低。在日常生活中,经常遇到排队 现象,如开车上班、在超市等待结账、工厂中等待加工的工件以及待 修的机器等。总之,排队现象是随处可见的。排队理论是运作管理中 最重要的领域之一,它是计划、工作设计、存货控制及其他一些问题 的基础。Matlab是MathWorks公司开发的科学计算软件,它以其强 大的计算和绘图功能、大量稳定可靠的算法库、简洁高效的编程语言 以及庞大的用户群成为数学计算工具
2、方面的标准,几乎所有的工程计算领域,Matlab都有相应的软件工具箱。选用Matlab软件正是基 于Matlab的诸多优点。排队模型三. 仿真算法原理(1)顾客信息初始化根据到达率入 和服务率来确定每个顾客的到达时间间隔和服 务时间间隔。服务间隔时间可以用负指数分布函数 exprnd()来生成 由于泊松过程的时间间隔也服从负指数分布,故亦可由此函数生成 顾客到达时间间隔 。需要注意的是 exprnd() 的输入参数不是到达率 入和服务率口而是平均到达时间间隔1/入和平均服务时间1/卩。根据到达时间间隔 , 确定每个顾客的到达时刻 . 学习过 C 语言 的人习惯于使用FOR循环来实现数值的累加,
3、但FOR循环会引起运 算复杂度的增加 而在MATLAB仿真环境中,提供了一个方便的函数 cumsum() 来实现累加功能 读者可以直接引用对当前顾客进行初始化。 第 1 个到达系统的顾客不需要等待就 可以直接接受服务 其离开时刻等于到达时刻与服务时间之和。(2)进队出队仿真在当前顾客到达时刻, 根据系统内已有的顾客数来确定是否接纳 该顾客。 若接纳 则根据前一顾客的离开时刻来确定当前顾客的等待 时间 、离开时间和标志位 ;若拒绝, 则标志位置为 0.流程图如下:讣牛K容的离开时i=2N箍工朴按渝、第i牛嗾窖? ”/林*kfifKmAi+I1*1 MSfii节操客的VWHM.育开时诃、标志位;四
4、、程序实现单服务台服务,服务参数 M/M/1,入二卩二,排队规则为FIFO,以 分为单位,仿真时间240分钟。仿真程序代码如下%总仿真时间Total_time = 240;%到达率与服务率 lambda =;mu =;%平均到达时间与平均服务时间 arr_mean = 1/lambda;ser_mean = 1/mu;%可能到达的最大顾客数( round :四舍五入求整数) arr_num = round(Total_time*lambda*2);%顾客事件表初始化events = ;%按负指数分布产生各顾客达到时间间隔events(1,:) = exprnd(arr_mean,1,arr_n
5、um);%各顾客的到达时刻等于时间间隔的累积和events(1,:) = cumsum(events(1,:);%按负指数分布产生各顾客服务时间events(2,:) = exprnd(ser_mean,1,arr_num); %计算仿真顾客个数,即到达时刻在仿真时间内的顾客数 len_sim = sum(events(1,:)Total_timebreak;%如果第 i 个顾客的到达时间未超过仿真时间,则计算在其 %到达时刻系统中已有的顾客个数else number = sum(events(4,member) events(1,i);%如果系统已满,则系统拒绝第 i 个顾客,其标志位置 0
6、 if number = N+1events(5,i) = 0;%如果系统为空,则第 i 个顾客直接接受服务 else if number = 0%其等待时间为 0 events(3,i) = 0;%其离开时刻等于到达时刻与服务时间之和 events(4,i) = events(1,i)+events(2,i);%其标志位置 1events(5,i) = 1;member = member,i;%如果系统有顾客正在接受服务,且系统等待队列未满,则%第 i 个顾客进入系统else len_mem = length(member);%其等待时间等于队列中前一个顾客的离开时刻减去其到%达时刻even
7、ts(3,i)=events(4,member(len_mem)-events(1,i);%其离开时刻等于队列中前一个顾客的离开时刻加上其服 %务时间 events(4,i)=events(4,member(len_mem)+events(2,i);%标识位表示其进入系统后,系统内共有的顾客数 events(5,i) = number+1;member = member,i;endendendend五、仿真结果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. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 深度解析(2026)《GBT 33540.1-2017风力发电机组专用润滑剂 第1部分:轴承润滑脂》(2026年)深度解析
- 深度解析(2026)《GBT 33478-2016党政机关电子公文应用接口规范》(2026年)深度解析
- 任务1.4添加店铺产品
- Starter Unit 1 Section A(1a2d) 七年级英语上册(人教版2024)
- 多发性内分泌腺瘤1型临床指南
- 胸部外伤病人的课件
- 医疗数据安全意识培养:区块链创新实践
- 医疗数据安全合规的区块链沙盒机制
- 医疗数据安全区块链技术的生态构建与价值共创实践
- 医疗数据安全分级保护区块链落地难点与对策
- 电力市场概论张利课后参考答案
- 叶朗美学原理
- 现代食品加工技术(食品加工新技术)智慧树知到期末考试答案章节答案2024年中国农业大学
- 中学语文教学设计智慧树知到期末考试答案章节答案2024年河南大学
- 儿科泌尿系感染的护理
- 超市防损培训课件
- 2024年福建省2024届高三3月省质检(高中毕业班适应性练习卷)英语试卷(含答案)
- 污水源热泵技术RBL北京瑞宝利热能科技有限公司
- 《精神病》4人搞笑小品剧本台词
- 工商银行全国地区码
- 锥齿轮加工工艺和夹具设计
评论
0/150
提交评论