Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Case 3: Single-que (Oue). Multiple server (Siv) Given random arrival intervals (Art) and random service intervals (Sv), tind the history of arrivals and departures, queue

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Case 3: Single-que (Oue). Multiple server (Siv) Given random arrival intervals (Art) and random service intervals (Sv), tind the history of arrivals and departures, queue size, and service number, INPUT DEFINITIONS: timectis= (tinit,tfinal, delt) & Arra Randomly generated arrival intervals SI 15rvi: srv21 First row is randomly generated service intervals for Srvi Second row is randomly generated service intervals for Srv2 InitState= (narr, nQue, nsrv2, nep1.nsrv2, Dep2] InitTimes= (textarr, textDepi, tnextDep21 5 veda OUTPUT DEFINITIONS: (col vets) histArn arrival history histQue, queue size history histSrvi, service history histDepl, departure history list srv2, service history histDep2, departure history 1 % Set time controls (service Window open time in minutes) 2 tinit= 0; % initial time (opening) 3 tfinal= 120; % final time (in minutes) 4 delt= 1; % step size is 1 minute 5 6 % Initialize arrival and service distributions 7 % arrival intervals are random uniform 8 Arrmin= 2; min arrival interval 9 Arrmax= 6; % max arrival interval 10 Arrrng= Arrmax -Arrmin +1; 11 nsteps1= (tfinal-tinit)/delt +1; 12 Arr=zeros(1, nsteps1); 13 for i=1:nsteps1 14 Arr(i) = randi(Arrrng) +Arrmin-1; 15 end 16 % service intervals 51 and 52 are random uniform 17 Srvimin= 7; % min service duration 18 Srvimax= 9; % max service duration 19 SrvZmin= 7; % min service duration 20 Srv2max= 9; % max service duration 21 Srvirng= Srvimax -Srvimin +1; 22 Srv1=zeros(1, nsteps1); 23 for i=1:nsteps1 24 Srvi(i) = randi(Srvirng) +Srvimin-1; 25 end 26 27 Srv2rng= SrvZmax -Srv2min +1; 28 Srv2=zeros(1, nsteps1); 29 for i=1:nsteps1 30 Srv2(1) - randi (srv2rng) +Srv2min-1; 31 end 32 Initialize the system state 33 nArr=; number of arrivals at 01 34 nQue= 0; 35 nSrvl= 0; 26 Dani 11 20 Dep28: thextastinis textbeple tinatele.delt texte finaleledett SIMULATION SECTION 5 tinctis itinit,tfinal,det): Sre Isrva srv21: Init states InArr.nouensrvi, neplnev2, Dep21: Initines textarr, textbel, textoep21 this tarr, bastgue, histvi, step history, histop2] Quevexno. fonctinectls, arr. rv, in state, Intries) 51 DISPLAY SECTION steps1= tfinal-tinit)/delt +1; number of steps to run +1 zeros(steps1,1); 35 for 11: linsteps: t. 11 tinst +-1).delt: clock tine 57 end 5 fprintfi'in Queueing Model Jin forint Setup Conditions: forint in tinit.of.tfinale15.1, soltan, tinit, final delta forintf Arr interval thin, Arrnin printre Arr interval na 5.7in, Arrax) fprintfin Srv interval win 45.11, Srvinin) fprintft Sivt interval max 5.1.Sevinax) printre Sin interval nini. Syd) forintSv interval max, Sv2x) forintf Performance dotain Tarte histrinsteps1,1 7 fprintfin Total arrived Art 73 fprintf(' Srvi departed= 85.0f ', histDepi(nsteps1, 1)); 74 fprintf(' Srv2 departed= 45.0f ', histDep2(nsteps1,1)); 75 76 maxQue= max(histQue); 77 fprintf(" max in Que: 84.0f ', maxQue); 78 meanQue= mean(histQue); 79 fprintf(". mean in Que: $5.1f ',meanQue); se 81 usage1= sum(histSrvi)steps1; 82 fprintf(' Si usage fraction:%5.2f ', usagel); 83 usage2= sum(histsrv2)steps1; 84 fprintf("S2 usage fraction:85.2f ', usage2); 85 86 res lbl = ' Time Arr Que Srvi Dep1 Srv2 Dep2 '; 87 fprintf(reslbl); 88 fmt res= [' %3.0f', repmat('%6.0f', 1,6), ' '); 89 % show first part of log 98 for i=1:1:10 91 fprintf(fmtres, tc(i), histArr(1),histQue(1),... 92 histSrvl(i), histDep1(i), histsrv2(i), histDep2(i)); 93 end 94 % show last part of log 95 fprintf(' '); 96 for i=nsteps1-9:1:nsteps1 97 fprintf(fmtres, tc(i), histArr(i), histQue(i),... 98 histSrvi(i), histDepi(i), histsrv2(i), histDep2(i)); 99 end 100 fprintf(' '); 101 102 figure 103 194 subplot(2,1,1) 105 histDep= histDep1 +histDep2; 106 plot(tc, histArr, tc, histDep); 107 legend('arrive', 'depart', 'Location','northwest'); 108 title('Arrival and departure history'); arrival served departure SYSTEM DIAGRAM WAITING AREA SERVICE WINDOW Current Being queue enter service How can we build a model so we can investigate system performance? Look at the service operation first. THE SERVICE OPERATION: BOOK-KEEPING Being enter served service depart Stort clock when window opens. . Check the clock every minute for server status. Status of server 0 or 1 customer if 1, is service interval over Yes, then done. If done now, departure and set status to 0. If 0, and if customer waiting, pop into service. Get new service interval. Status to 1. . . TRACKING VARIABLES FOR SERVER 1 nQuel Being served nser Departe nDepl= nDep1+1 Clock: tc= (0,1,2,3,4....) in minutes nQue1 is 0.1.2.... . nSerla Is 0 or 1 in our facility If nSer1=0 and nQuel>0, then . If nSer1=1 and tc == Dep, thene etc. Lots of moving parts... a flowchart may be helpful TRACKING VARIABLES FOR MODEL nQuel nSer1 nal nDep! Arrivals are governed by a distribution. We will use uniform random arrival intervals. Service is governed by a distribution. We will use uniform random service intervals. ARRIVAL INTERVAL GENERATOR: UNIFORM RANDOM MODEL Amin: minimum orival interval (integer, in minutes) Amax maximum arrival interval Aint: random arrival interval Example: suppose Amin=2 and Amar 7 Values for Aint are drawn from (2.3.4.5.6.7] uniformly. Q1. What is the expected mean for inte Q2. Could Amin=0 meaningfully SERVICE INTERVAL GENERATOR: UNIFORM RANDOM MODEL Smin: minimum service interval (integer, in minutes) Smax maximum service Interval Sint: random service interval Example: suppose Smin=4 and Smax=8 Values for Sint are drawn from 990) uniformly. Q1. What is the expected mean for Sinta Q2. Could Sint-Omeaningfulye SYSTEM PERFORMANCE IN SERVICE WAITING nQuel nSer1 NAIT ndep Important performance measures: > What is the average queue length What is the largest queue size? What is the usage rate for the service window SYSTEM BALANCING nQuel nSer1 nDep Arrival intervals: expected mean Service intervals: expected mean Three Important situations: > mean(Aint) = mean/Sint) > mean(Alnt) > mean(Sint) mean(Aint) 0, then . If nSer1=1 and tc == Dep, thene etc. Lots of moving parts... a flowchart may be helpful TRACKING VARIABLES FOR MODEL nQuel nSer1 nal nDep! Arrivals are governed by a distribution. We will use uniform random arrival intervals. Service is governed by a distribution. We will use uniform random service intervals. ARRIVAL INTERVAL GENERATOR: UNIFORM RANDOM MODEL Amin: minimum orival interval (integer, in minutes) Amax maximum arrival interval Aint: random arrival interval Example: suppose Amin=2 and Amar 7 Values for Aint are drawn from (2.3.4.5.6.7] uniformly. Q1. What is the expected mean for inte Q2. Could Amin=0 meaningfully SERVICE INTERVAL GENERATOR: UNIFORM RANDOM MODEL Smin: minimum service interval (integer, in minutes) Smax maximum service Interval Sint: random service interval Example: suppose Smin=4 and Smax=8 Values for Sint are drawn from 990) uniformly. Q1. What is the expected mean for Sinta Q2. Could Sint-Omeaningfulye SYSTEM PERFORMANCE IN SERVICE WAITING nQuel nSer1 NAIT ndep Important performance measures: > What is the average queue length What is the largest queue size? What is the usage rate for the service window SYSTEM BALANCING nQuel nSer1 nDep Arrival intervals: expected mean Service intervals: expected mean Three Important situations: > mean(Aint) = mean/Sint) > mean(Alnt) > mean(Sint) mean(Aint)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago