PDA

View Full Version : VBA problem



chris80
10-23-2008, 04:50 PM
This the problem I have to code.
Orders arrive at an assembly line in accordance with an exponential distribution with a mean time between arrivals of five minutes. The assembly line consists of three workstations. Assembly is done in sequential workstation order. The work on a unit must be completed in Workstation 1 before work can begin on the unit in Workstation 2 and a unit's processing must be completed in Workstation 2 before processing can begin in Workstation 3. Processing time for each workstation is exponentially distributed with the following times to completion.

Workstation 1's mean time to completion = 3.2 minutes
Workstation 2's mean time to completion = 2.89
Workstation 3's meantime to completion = 4.1.

There is a buffer area in front of Workstation 2 that can hold 2 partially completed units. The buffer area in front of Workstation 3 can hold 3 partially completed units. If an order cannot enter Workstation 1 because it is occupied then that order is routed to another assembly line in the plant. Simulate the process for 10,000 orders. Assume the process runs for eight hours each day. To begin the simulation assume that each buffer and workstation is empty.

Use a VBA simulation model with 10,000 replications to answer the follow:
1)What is the number of orders that needed to be diverted
2) What is the average number of orders filled each day at the assembly line

here is what I have so far:
Public Function invexp(mean)
invexp = -mean * Log(1 - Rand)
End Function
Sub ProjectAcz()
Dim incoming As Single
'arrival time with a mean of 5 minutes
Dim w1 As Single
'workstation 1 with a mean of 3.2
Dim w2 As Single
'workstation 2 with a mean of 2.89
Dim w3 As Single
'workstation 3 with a mean of 4.1


End Sub
And now I'm stuck. :banghead: