3. 点击source1,在Entity class处写Call,Arrivals defined by选择Rate,Arrival
rate填写ArrivalRate1,Entities per arrival填写1,New entity填写new Call(),On exit填写setCallParameters( entity, 1 );在source2处在以上各处分别填写ArrivalRate2、1、new Call()、setCallParameters( entity, 2 )。
4. 点击queue1,在Entity class处写Call,Capacity选择Integer.MAX_VALUE,
On enter填写routingLogic(),并勾中Enable exit on timeout,Timeout填写entity.abandonmentTime,On exit(timeout)填写nAbandoned1++; queue2的参数与queue1基本相同,只有在On exit(timeout)处填写nAbandoned2++。
5. 点击service1,在Entity class出填写Call,Resource quantity填写1,Delay
time写 serviceTime( entity, 1 ),ResourcePool object为null,On enter delay填写callAnswered( entity );,On exit填写routingLogic();,Queue capacity为100。点击agents1,Resource units are选择Individual objects,Capacity defined选择Directly,Capacity填写NAgents1。service2与service1设置基本相同,在上述各处分别填写Call、1、serviceTime( entity, 2 )、null、callAnswered( entity );、routingLogic();、100。agents2与agents1设置基本相同,各处分别为Individual objects、Directly和NAgents2
6. 从General中拖入一个Function,命名为resetStats,返回类型选择void,
Code中写入:
7. 从Analysis拖入两个Histogram data,分别命名为histWait1和histWait2。
二者设置相同,Number of intervals填写为20,Values range选择fixed,minimum为0,Maximum为100。
第四步:建立安排逻辑
1. 点击Actionchart,通过其下面的部件创建如下逻辑图:
2. 设置参数。在idleAgents1处,Type选择int,Initial value为agents1.idle(),
idleAgents2与idleAgents1类似,只不过在initial value处填写agents2.idle()。在第一个while循环处的条件是idleAgents1 > 0 && queue1.size() > 0,在该循环里面的code为enter1.take( queue1.removeFirst() ); idleAgents1--;。
第二个while循环处的条件是idleAgents2 > 0 && queue2.size() > 0,里面的code为enter2.take( queue2.removeFirst() );idleAgents2--;之后的Decision处的判断条件是allowRouting12。如果条件为true则进入第三个循环,条件为idleAgents2 > 0 && queue1.size() >0,循环里的Code为
enter2.take( queue1.removeFirst() );idleAgents2--;nRouted12++;。最后进入返回。
第五步:创建界面
界面总体的布局截图如下:
1. 选取另一块区域,点击Enterprise Library,从中有、拖入一个Clock,命名
为clock,其Background color、Border color、Hour mark color、Text color、Hour and minute hand color、Second hand color分别为ghostWhite、steelBlue、lightSteelBlue、steelBlue、black、fireBrick。
2. 在Controls中拖入八个Slider,其中四个控制第一类电话的参数,另外四
个为控制第二类电话的参数。控制到达率的勾中Link to,填写ArrivalRate1,minimum value为0,Maximum value为3;控制代理数目的勾中Link to,填写NAgents1,minimum value为50,Maximum value为200;控制专类服务时间的勾中Link to,填写ServiceTime1,minimum value为30,Maximum value为300;控制非专类服务时间的勾中Link to,填写ServiceTime12,minimum value为30,Maximum value为300。另外四个
Slider的参数与之前的四个相同,只是在Link to处分别填写ArrivalRate2、NAgents2、ServiceTime2、ServiceTime21。具体位置如下:
3. 在Controls中拖入一个Check Box,勾中Link to,填写allowRouting12,
Action中填写resetStats()。用来控制第二类代理能否处理第一类的电话。 4. 在Controls中拖入一个Button,Action处填写resetStats()。
5. 在Presentation中利用Polyline、Rectangle、line、Text等创建如上图所示
界面。
6. 在八个Slider上方的Arrival旁的123的Dynamic中的Text中填写
format( ArrivalRate1 )和format( ArrivalRate2 ),Number旁的123的Dynamic中的Text中填写format( NAgents1 )和format( NAgents2 ),Service Time1旁的123的Dynamic的Text处填写format( ServiceTime1 ),Service Time2旁的123的Dynamic的Text处填写format( ServiceTime2 ),Service Time12旁的123的Dynamic的Text处填写format( ServiceTime12 ),Service Time21旁的123的Dynamic的Text处填写format( ServiceTime21 )。 7. 中间界面处的123的Dynamic的Text处从上到下分别填写
format( nAbandoned1 )、format( nOK1 )、format( nRouted12 )、format( nLate2 )、format( nOK2 )、format( nAbandoned2 )。
8. 点击Analysis,拖入两个Time Plot,在Value,并分别填写queue1.size()
和queue2.size()。二者的Time Window填写10000,vertical scale选择fixed,
相关推荐: