实验2 单服务台单队列排队系统仿真 联系客服

发布时间 : 星期二 文章实验2 单服务台单队列排队系统仿真更新完毕开始阅读83b60739168884868762d6f5

同样设置drain中entrance属性值为.Models.QueueSystem.QueueFrame. ComputeQueueLength

14. 代码 Reset代码:

is do

deleteMovables;

QueueNumberCount:=0; end; Init代码

is do

QueueNumberCount:=0; end;

Endsim代码

is

tab:table; do

tab.create;

Buffer.statistics(tab); buffer.statistics;

QueueTab[1,SimulationTimes]:=SimulationTimes; QueueTab[2,SimulationTimes]:=tab[4,1]; QueueTab[4,SimulationTimes]:=tab[9,1]; QueueTab[5,SimulationTimes]:=tab[6,1];

tab.delete;

singleProc.statistics(tab);

CustomsTab[1,SimulationTimes]:=SimulationTimes; CustomsTab[2,SimulationTimes]:=tab[5,1]; CustomsTab[3,SimulationTimes]:=tab[20,1]; CustomsTab[4,SimulationTimes]:=tab[15,1]; CustomsTab[5,SimulationTimes]:=tab[17,1];

if SimulationTimes<30 then .models.queuesystem.queueframe.EventController.reset; SimulationTimes:=SimulationTimes+1; .models.queuesystem.queueframe.EventController.start; else SimulationTimes:=1; end; end;

ArrivalIntervalTime代码

is

rand:real; do

rand:=Z_uniform(SimulationTimes,0,1); if rand>0.0 and rand<=0.125 then Source.interval:=60*1;

elseif rand>0.125 and rand<=0.250 then Source.interval:=60*2;

elseif rand>0.250 and rand<=0.375 then Source.interval:=60*3;

elseif rand>0.375 and rand<=0.5 then Source.interval:=60*4;

elseif rand>0.5 and rand<=0.625 then Source.interval:=60*5;

elseif rand>0.625 and rand<=0.75 then Source.interval:=60*6;

elseif rand>0.75 and rand<=0.875 then Source.interval:=60*7;

elseif rand>0.875 and rand<=1.0 then Source.interval:=60*8; end;

@.arrivalTime:=eventcontroller.simtime; end;

CustomServerTime代码

is

rand:real; do

@.serverTime:=SingleProc.ProcTime; rand:=Z_uniform(1,0,1);

if rand>0.0 and rand<=0.1 then SingleProc.ProcTime:=60*1; elseif rand>0.1 and rand<=0.3 then SingleProc.ProcTime:=60*2; elseif rand>0.3 and rand<=0.6 then SingleProc.ProcTime:=60*3; elseif rand>0.6 and rand<=0.85 then SingleProc.ProcTime:=60*4;

elseif rand>0.85 and rand<=0.95 then SingleProc.ProcTime:=60*5; elseif rand>0.95 and rand<=1.0 then SingleProc.ProcTime:=60*6; end; end;

ComputeQueueLength代码

is do

QueueNumberCount:=QueueNumberCount+1;

QueueTab[3,SimulationTimes]:=(QueueTab[3,SimulationTimes]*(QueueNumberCount-1)+Buffer.numMU)/QueueNumberCount;

if simulationTimes=1 and QueueNumberCount=1 then Customs20Tab[1,QueueNumberCount]:=QueueNumberCount; Customs20Tab[2,QueueNumberCount]:=@.arrivalTime; Customs20Tab[3,QueueNumberCount]:=0; Customs20Tab[4,QueueNumberCount]:=@.serverTime; Customs20Tab[5,QueueNumberCount]:=@.statAvgLifeSpan-@.serverTime;

elseif simulationTimes=1 and QueueNumberCount<=20 then Customs20Tab[1,QueueNumberCount]:=QueueNumberCount; Customs20Tab[2,QueueNumberCount]:=@.arrivalTime;

Customs20Tab[3,QueueNumberCount]:=@.arrivalTime-Customs20Tab[2,QueueNumberCount-1]; Customs20Tab[4,QueueNumberCount]:=@.serverTime; Customs20Tab[5,QueueNumberCount]:=@.statavglifespan-@.serverTime; end; end;

5 实验要求

5.1 按照上面的介绍建立单服务台仿真模型,并给出各个表格中各数据的含义。

5.2 在练习上述排队系统仿真的基础上,调研真实的银行系统,增加以下几个功能:

(1) 服务窗口从一个增加为多个;

(2) 业务范围从一种增加为多种(一般客户、企业客户); (3) 增加多个ATM取款机。 实验报告提纲: (1) 仿真目标 (2) 系统调研 (3) 系统假设 (4) 系统建模 (5) 仿真模型

(6) 仿真结果分析 (7) 心得体会