Anda di halaman 1dari 15

# Single Server Queue

## Distribution of Time Between Arrivals

Time b/w Arrivals (Mins) 1 2 3 4 Probability .3 .2 .3 .2 Cumulative Probability .30 .50 .80 1.00 Random Digit Assignment 01-30 31-50 51-80 81-00

temp=0; count=0; while(temp>=0) { scanf("%f",&temp); tba [count]=temp; count=count+1; } count=count-1; for (i=0;i<=count-1;i++) { printf("\t %f\t\t\t",tba[i]); scanf("%f",&tbap[i]); } sum=0;

for (i=0;i<=count-1;i++) { sum=sum+tbap[i]; } if (sum==1) { printf("enter arrival time and its probability are entered successfully"); printf("\n press any key to coninue"); getch(); } else { printf("enter the probability values again\n"); goto prob_int_arr_time; }

Service-Time Distribution
Service Time (Mins) Probability Cumulative Probability Random Digit Assignment

1 2 3

## 01-40 41-70 71-00

printf("\n enter the values for service time (-ve value to terminate)\n"); temp1=0; count1=0; while(temp1>=0) { scanf("%f",&temp1); st [count1]=temp1; count1=count1+1; } count1=count1-1; //printf("%d",count1); prob_ser_time:

for(i=0;i<=count1-1;i++) { printf("\t %5.2f\t\t\t",st[i]); scanf("%f",&stp[i]); } sum=0; for(i=0;i<=count1-1;i++) { sum=sum+stp[i]; } if(sum==1) { printf("service time and its probability are enetred successfully"); printf("\n press any key to continue"); getch(); } Else { printf("enter the probability values again\n"); goto prob_ser_time; }

/*for inter arrival time*/ tag[0]=0; for(i=1;i<=count;i++) { tag[i]=tag[i-1]+tbap[i-1]*100; printf("\n %d",tag[i]); } /*for service time*/ tag1[0]=0; for(i=1;i<=count1;i++) { tag1[i]=tag1[i-1]+stp[i-1]*100; printf("\n %d",tag1[i]); } getch();

printf("\n enter no. of times to simulate :"); scanf("%d",&n); tsla[0]=0; for(i=0;i<=n-1;i++) { r1[i]=rand()%100; r2[i]=rand()%100; for(j=0;j<=count;j++) { if((tag[j]<=r1[i])&&(tag[j+1]>r1[i])) { tsla[i+1]=tba[j]; } }

for(j=0;j<=count1-1;j++) {
if((tag1[j]<=r2[i])&&(tag1[j+1]>r2[i])) { sst[i]=st[j]; } } printf("\n%d\t%d\t%5.2f\t%d\t%5.2f",i,r1[i],tsla[i],r2[i],sst[i]); }

## Simulation Table for single-Channel Queuing Problem

Customer Interarrival Time 1 2 3 2 2 Arrival Time Service Time Time Service Begins 2 1 1 2 4 6 Waiting Time in Queue 0 0 0 Time Service Ends 4 5 7 Time Customer Spends in System 2 1 1 0 1 Idle Time of server

2 4 6

4 5
6 7 8 9 10

3 3
3 1 4 3 4

9 12
15 16 20 23 27

2 2
2 1 3 2 1

9 12
15 17 20 23 27

0 0
0 1 0 0 0

11 14
17 18 23 25 28

2 2
2 2 3 2 1

2 1
1 0 2 0 2

Average waiting time for a customer = total time customers wait in queue/(total no. of customers) Probability that a customer has to wait in queue= no. of customers who wait/(total no. of customers) Probability of idle server= total idle time of server/total run time of simulation Average service time = total service time/total no. of customers Average time b/w arrivals= sum of all times b/w arrivals/no. of arrivals-1 Average waiting time of those who wait= total time customer wait in queue/total no of customers that wait Average time customer spends in the system = total time customers spend in the system/total no of customers

## SIMULATION OF INVENTORY MODEL

LEAD TIME Probability Cumulative Probability Random Digit Assignment

1
2 3

.60
.30 .10

.60
.90 1.00

01-60
61-90 91-00

## Usage During Lead Time Distribution

Usage Probability Cumulative Probability Random Digit Assignment

0 1 2 3 4

## SIMULATION OF INVENTORY MODEL

Trials Random Numbers 45 29 80 89 57 15 93 13 45 25 Simulated Simulated Simulated Simulated Simulated Lead Time Lead Time Lead Time Stock Shortage Rqmnts Demand 1 1 2 3 1 1 3 1 1 1 2 1 3 4 2 1 4 1 2 1 2 1 6 12 2 1 12 1 2 1 1 2 0 0 1 2 0 2 1 2 0 0 3 9 0 0 9 0 0 0

1 2 3 4 5 6 7 8 9 10

THANKS