Beruflich Dokumente
Kultur Dokumente
Macros:
Sub MSQAT()
' Calculate the "Time between Arrival" and "CLK for Arrival" for Multi server queue problem.
For custCount = 28 To 46
rnIAT = Range("B" + CStr(custCount)).Value
For iatTable = 4 To 8
minRange = "D"
minRange = minRange + CStr(iatTable)
Trim (minRange)
maxRange = "E" + CStr(iatTable)
Trim (maxRange)
If Range(maxRange).Value = 0 Then
rowNo = iatTable
End If
Next iatTable
Range("A" + CStr(rowNo)).Select
Selection.Copy
Range("C" + CStr(custCount)).Select
ActiveSheet.Paste
Next custCount
End Sub
Sub MSQST()
' This macro generates last seven columns in the MSQ problem, namely Time Service Begins, Service
Time, Time Service Ends for both Able and Baker and Time in Queue column.
'The first customer will be served by the Able. Thus, initialize Ables' first row
Range("F27").Value = 0
Range("G27").Value = GetStforAble(Range("E27").Value)
Range("H27").Value = GetStforAble(Range("E27").Value)
1
Exit Do
End If
If (tempCustCount = 27) Then 'if the loop reaches the row of first customer
ableTSE = 0 'this means Baker did not served any request yet
'(though this condition never occurs, it occues for Baker)
Exit Do
End If
Loop
2
'This function returns the Service time for the Able provided the Random Number(RN) for service
'time as input
Function GetStforAble(ByVal rnst As Integer) As Integer 'rnst => Random Number for Service Time
maxRange = "E" + CStr(stAbleTable) 'Get the cell number for the Maximum Value for
Current Range Interval
Trim (maxRange)
retValCell = "A" + CStr(rowNo) 'Form the cell no. containing the needed service time
'This function returns the Service time for the Able provided the Random Number for service time as
'input
'Similar to GetStforAble, get the help from its comments
Function GetStforBaker(ByVal rnst As Integer) As Integer 'rdst => Random Digit for Service Time
For stBakerTable = 19 To 22
minRange = "D" + CStr(stBakerTable)
Trim (minRange)
If Range(maxRange).Value = 0 Then
rowNo = stBakerTable
End If
Next stBakerTable
End Function
Sub CalcStats()
' CalcStats Macro
'Calculating Total Serivice Time for Able
3
ttlServiceAbleTime = 0
For custCount = 27 To 46
If (Range("G" + CStr(custCount)).Value <> 0) Then
ttlServiceAbleTime = ttlServiceAbleTime + Range("G" + CStr(custCount)).Value
End If
Next custCount
Range("G47").Value = "Total ST = " & ttlServiceAbleTime
End Sub
4
Output:
Random Digit Assignment to Interarrival Time
IAT Probablity Cum Probability R.N. (Min) R.N. (Max) R.N. Range
1 0.05 0.05 01 05 1-5
2 0.25 0.3 06 30 6-30
3 0.3 0.6 31 60 31-60
4 0.25 0.85 61 85 61-85
5 0.15 1 86 00 86-0
1 25 0 3 3
2 95 5 5 38 5 3 8 0
3 26 2 7 61 7 4 11 0
4 43 3 10 52 10 3 13 0
5 71 4 14 1 14 2 16 0
6 12 2 16 47 16 3 19 0
7 51 3 19 72 19 4 23 0
8 80 4 23 89 23 5 28 0
9 68 4 27 39 27 4 31 0
10 34 3 30 64 30 4 34 0
11 62 4 34 90 34 5 39 0
12 7 2 36 2 36 3 39 0
13 81 4 40 82 40 4 44 0
14 97 5 45 44 45 3 48 0
15 76 4 49 19 49 2 51 0
16 33 3 52 75 52 4 56 0
17 49 3 55 51 55 4 59 0
18 21 2 57 97 57 5 62 0
19 5 1 58 31 59 3 62 1
20 22 2 60 73 62 4 66 2
Total
Time
in
Queue:
Total ST = 54 Total ST = 18 3
Queuing Statistics
Time Able was busy: 54 Min (0.818181818181818 %)
5
Time Baker was busy: 18 Min (0.272727272727273 %)
Number of Customers need to wait: 2 (10 %)
Average waiting time for all customers: 0.15