def Arrival(): NewCar = bc.Entity(Clock) ParkingLot.Add(NewCar, Clock) VBASim.Schedule(Calendar, "Arrival", RNG.Expon(MeanTBA, 1), Clock) VBASim.Schedule(Calendar, "Departure", RNG.Expon(MeanPT, 2), Clock) global MaxCars if ParkingLot.NumQueue() > MaxCars: MaxCars = ParkingLot.NumQueue()
def Arrival(): VBASim.Schedule(Calendar, "Arrival", RNG.Expon(MeanTBA, 1), Clock) Customer = Basic_Classes.Entity(Clock) Queue.Add(Customer, Clock) # queue here includes the customers in service if Server.Busy < Server.NumberOfUnits: # if there is an idle server available Server.Seize(1, Clock) VBASim.Schedule(Calendar, "EndOfService", RNG.Erlang(Phases, MeanST, 2), Clock)
def Arrival(): VBASim.Schedule(Calendar, "Arrival", RNG.Expon(MeanTBA, 1), Clock) Customer = Basic_Classes.Entity(Clock) Queue.Add(Customer, Clock) if Server.Busy < Server.NumberOfUnits: # if not all servers are busy, we can schedule a service Server.Seize(1, Clock) VBASim.Schedule(Calendar, "EndOfService", RNG.Erlang(Phases, MeanST, 2), Clock)
def Arrival(): VBASim.Schedule(Calendar, "Arrival", RNG.Expon(MeanTBA, 1), Clock) Customer = Basic_Classes.Entity(Clock) Queue.Add(Customer, Clock) if Server.Busy == 0: Server.Seize(1, Clock) VBASim.Schedule(Calendar, "EndOfService", RNG.Erlang(Phases, MeanST, 2), Clock)
def Arrival2(): VBASim.Schedule(Calendar, "Arrival2", RNG.Expon(MeanTBA2, 2), Clock) Customer2 = Basic_Classes.Entity(Clock) # Go to B, or add in Queue2 if ServerB.Busy < ServerB.NumberOfUnits: # Go to ServerB ServerB.Seize(1, Clock) VBASim.SchedulePlus(Calendar, "EndOfServiceB2", RNG.Expon(MeanPT2, 5), Customer2, Clock) else: # Add in Queue2 Queue2.Add(Customer2, Clock)
def Arrival(): VBASim.Schedule(Calendar, "Arrival", RNG.Expon(MeanTBA, 1), Clock) Customer = bc.Entity(Clock) if Server.Busy < Server.NumberOfUnits: Server.Seize(1, Clock) VBASim.SchedulePlus(Calendar, "EndOfService", RNG.Erlang(Phases, MeanST, 2), Customer, Clock) WaitingTime.Record(0) WTrecords.append(0) else: WaitingList.Add(Customer, Clock)
def Arrival(): VBASim.Schedule(Calendar, "Arrival", RNG.Expon(MeanTBA, 1), Clock) if Queue.NumQueue( ) >= c: # if there are c or more customers in the system, # the new customer will return after an exponentiallly distributed time VBASim.Schedule(Calendar, "Arrival", RNG.Expon(MeanTR, 1), Clock) else: # fewer than c customers in the system Customer = Basic_Classes.Entity(Clock) Queue.Add(Customer, Clock) if Server.Busy == 0: Server.Seize(1, Clock) VBASim.Schedule(Calendar, "EndOfService", RNG.Erlang(Phases, MeanST, 2), Clock)
def Arrival(): VBASim.Schedule(Calendar, "Arrival", RNG.Expon(MeanTBA, 1), Clock) Customer = Basic_Classes.Entity(Clock) Queue.Add(Customer, Clock) if Server.Busy < Server.NumberOfUnits: # if not all servers are busy, we can schedule a service Server.Seize(1, Clock) if Uniform(0, 1, 1) < 0.59: # 59% Financial Customer VBASim.Schedule(Calendar, "EndOfService1", RNG.Erlang(Phase1, MeanST1, 2), Clock) else: VBASim.Schedule(Calendar, "EndOfService2", RNG.Erlang(Phase2, MeanST2, 3), Clock)
def Arrival1(): VBASim.Schedule(Calendar, "Arrival1", RNG.Expon(MeanTBA1, 1), Clock) Customer1 = Basic_Classes.Entity(Clock) # Go to A, or go to B, or add in Queue1 if ServerA.Busy < ServerA.NumberOfUnits: # Go to ServerA ServerA.Seize(1, Clock) VBASim.SchedulePlus(Calendar, "EndOfServiceA", RNG.Expon(MeanPT1_1, 3), Customer1, Clock) elif (ServerB.Busy < ServerB.NumberOfUnits) and (Queue1.NumQueue == 0): # Go to ServerB ServerB.Seize(1, Clock) VBASim.SchedulePlus(Calendar, "EndOfServiceB1", RNG.Expon(MeanPT1_2, 4), Customer1, Clock) else: # Add in Queue1 Queue1.Add(Customer1, Clock)
def Arrival(): global Clock, rates VBASim.Schedule(Calendar, "Arrival", RNG.Expon(60.0 / rates[int(Clock / 60.0)], 1), Clock) Customer = Basic_Classes.Entity(Clock) if Uniform(0, 1, 1) < 0.59: # 59% Financial Customer Queue1.Add(Customer, Clock) if Server1.Busy < Server1.NumberOfUnits: # if not all servers are busy, we can schedule Service1 Server1.Seize(1, Clock) VBASim.Schedule(Calendar, "EndOfService1", RNG.Erlang(Phase1, MeanST1, 2), Clock) else: Queue2.Add(Customer, Clock) if Server2.Busy < Server2.NumberOfUnits: # if not all servers are busy, we can schedule a service Server2.Seize(1, Clock) VBASim.Schedule(Calendar, "EndOfService2", RNG.Erlang(Phase2, MeanST2, 3), Clock)