Docsity

Building an ATM Simulation: Code and Instructions - Prof. Debra Wood, Study notes of Mathematics

Toggle sidebar
bg1
Code for building 1 ATM
We have worked on building 1 ATM simulation for 1 hour
11. The following code should be in the following cells row 5 is customer 1
row 6 is customer 2
once row 6 is done you can drag it down for all 200 customers
Column F was done for you
Column G
Row 5
Row 6
Column H
Row 5
Row 6
Column I
Row 5
Row 6
Column J
Row 5
Row 6
Column K
Row 5
Row 6
Column L
Row 5
Row 6
Column M
=IF(C5>60,"",C5)
=IF(ISNUMBER(G5),IF(G5+C6>60,"",G5+C6),""
)
=IF(ISNUMBER(G5),D5,"")
=IF(ISNUMBER(G6),D6,"")
=IF(ISNUMBER(G5),G5,"")
=IF(ISNUMBER(G6),IF(G6>J5,G6,J5),""
)
=IF(ISNUMBER(G5),I5+H5,"")
=IF(ISNUMBER(G6),I6+H6,"")
=IF(ISNUMBER(G5),0,"")
=IF(ISNUMBER(G6),IF(I6-G6=0,0,I6-G6),"")
=IF(ISNUMBER(G5),F5,"")
=IF(ISNUMBER(G6),F6,"")
=IF(ISNUMBER(G5),IF(K5>5,"yes", "no"),"")
=IF(ISNUMBER(G6),IF(K6>5,"yes", "no"),"")
pf3
pf4
pf5

Partial preview of the text

Download Building an ATM Simulation: Code and Instructions - Prof. Debra Wood and more Study notes Mathematics in PDF only on Docsity!

Code for building 1 ATM We have worked on building 1 ATM simulation for 1 hour

  1. The following code should be in the following cells row 5 is customer 1 row 6 is customer 2 once row 6 is done you can drag it down for all 200 customers Column F was done for you Column G Row 5 Row 6 Column H Row 5 Row 6 Column I Row 5 Row 6 Column J Row 5 Row 6 Column K Row 5 Row 6 Column L Row 5 Row 6 Column M

=IF(C5>60,"",C5)

=IF(ISNUMBER(G5),IF(G5+C6>60,"",G5+C6),""

=IF(ISNUMBER(G5),D5,"")

=IF(ISNUMBER(G6),D6,"")

=IF(ISNUMBER(G5),G5,"")

=IF(ISNUMBER(G6),IF(G6>J5,G6,J5),""

=IF(ISNUMBER(G5),I5+H5,"")

=IF(ISNUMBER(G6),I6+H6,"")

=IF(ISNUMBER(G5),0,"")

=IF(ISNUMBER(G6),IF(I6-G6=0,0,I6-G6),"")

=IF(ISNUMBER(G5),F5,"")

=IF(ISNUMBER(G6),F6,"")

=IF(ISNUMBER(G5),IF(K5>5,"yes", "no"),"")

=IF(ISNUMBER(G6),IF(K6>5,"yes", "no"),"")

Row 5 Row 6 Column S Row 5 =COUNT(G5:G204) Row 10 =IF(S10="","",SUM(S10:S35)) Column T

Row 5 =SUM(K5:K204)

Row 10 =IF(T10="","",SUM(T10:T35))

Column U

Row 5 =MAX(K5:K204)

Row 10 =IF(U10="","",SUM(U10:U35))

Column V

Row 5 =COUNTIF(M5:M204,"yes")

Row 10 =IF(V10="","",SUM(V10:V35))

Column W

Row 5 =COUNTIF(P5:P204,"yes")

Row 10 =IF(W10="","",SUM(W10:W35))

Column X

Row 5 =SUM(O5:O204)

Row 10 =IF(X10="","",SUM(X10:X35))

Column Y

Row 5 =MAX(O5:O204)

Row 10 =IF(Y10="","",SUM(Y10:Y35))

  1. How to find the number of people in the queue. (customer’s number who is arriving) – (person using the ATM) = (number of people in the queue) Need to find out who is using the machine when a customer arrives. What did we do by hand? Looked at the arrival time and compared it to the pervious customer’s end of service time (counted the difference). Same idea here. Let excel find the customer who is at the ATM machine when the customer arrives. Excel can use the vlookup() of end of service times and returns the value of who is at the machine. So in columns N, O, and P type the following. It does take into consideration if arrival is before the end of service of the first customer. Column N Row 5 “states no one is at the ATM” Row 6 “if arrival is less than end of service of first customer returns a 1 or returns customer using ATM” Column O Finding how many is in the Queue when the customer arrives Row 5 Row 6 Column P States if person is irritated Row 5 Row 6
  2. Remember to drag row 2 down for all 200 customers
  3. Now check to see if your values equal the practice one given in class Practice Building 1 ATM (2)
  4. This was for one particular inter-arrival times and service times. We need to generate an inter-arrival time and service time for each customer. Create a duplicate worksheet and call it Building 1 ATM

=IF(ISNUMBER(G5),0,"")

=IF(ISNUMBER(G6),IF(G6<$J$5,1,VLOOKUP(G6,$J$5:L6,3)+1),"")

=IF(ISNUMBER(G5),0,"")

=IF(ISNUMBER(G6),L6-N6,"")

=IF(ISNUMBER(G5),IF(O5>3,"yes", "no"),"")

=IF(ISNUMBER(G6),IF(O6>3,"yes", "no"),"")

  1. To find a service time (unknown distribution – we will prove later) we will randomly pick a service time from our Data list using randbetween and vlookup. See if you can do this on your own, then check with the values below Column D Row 5 Row 6
  2. Now generate an inter-arrival time for each customer (this is a known distribution – we will prove later) p=1-e^(t/(mean)) solve for t (inter-arrival time) t=(mean)ln(1-p) where p is the probability (rand() number) Column B and C The mean is located in D Row 5 Row 6
  3. When you hit F9 you are generating a possible 1 hour run for the number of customers and what could happen. Save and close
  4. Now make changes to meet your team data a. Make a copy of this file call it “1 ATM team data” b. Open “1 ATM team data” file and open the file that contains your teams data c. In “1 ATM team data” delete the service time data A3:B
  5. Now copy your team’s service times data (both columns count and value) and paste it on this worksheet service time Starting in A When you get done column A has number 1 though (number of service times you were given) and column B has the value. Write down the location of the data and the number of service times Location of service times data__________ Number of service times _____________
  6. Go to worksheet Building 1ATM (if you wish you could delete the two practice worksheets)
  7. In Cell D3 type in your mean time for first hour inter-arrival times (now the inter-arrival times will be based on your mean)
  8. We need to change the service times it generates – since we have changed that Change the randbetween(1,” the number of service times you were given ”), Change the Service times’!$A$3:$B$( ),2) fill in the blank with your location of service time last entry
  9. Make sure you drag customer 2 (row 6) (B6:D6) down to all 200 customers
  10. Now hit F9 to see what one hour might look like
  11. We need lots of run (hours) to see what might happen and we need to record them. Copy S5:Z5 and paste special in S11:Z11. You are recording the results of 1 hour
  12. Now hit F9 and see another run. Copy S5:Z5 and paste special in S12:Z12 (each recording place in the row between the last entry)
  13. Now hit F9 and record this run. Do this for 7 recorded runs.
  14. Hit F9, now you have results of 7 hours
  15. Get with your team mates and get their 7 runs. Record them until you have 26 runs (You will be using 6 or 7 runs from each student depending on how many student are on your team). Some people type them, other send results on excel and copy and paste. 26 runs means ½ year of data.
  16. Now make a duplicate worksheet now change cell D3 to your second hour mean inter-arrival time. Hit F
  17. Now record these results like you did for step 16-
  18. Now your team will submit this R1-AF35, for each of the hours, so I can see the results

=VLOOKUP(RANDBETWEEN(1,7634), 'Service times'!$A$3:$B$7636,2)

=VLOOKUP(RANDBETWEEN(1,7634), 'Service times'!$A$3:$B$7636,2)

=RAND() =-$D$3*LN(1-B5)

=RAND() =-$D$3*LN(1-B6)