예제 #1
0
def bank_teller_kiosk():
    des.clear()
    des.Storage("Tellers", 2)
    des.Storage("Kiosks", 5)

    des.GenerateBlock("GeneratePeople", "Uniform", 0, 3)
    # People arrive between 0 - 5 minute with an uniform distribution
    des.TransferBlock("NeedsToSeeTeller", 60, "Teller")
    # There is fifty percent chance that a people needs to go to teller
    des.QueueBlock("KioskQue")
    des.EnterBlock("Kiosk", "Kiosks", 1)
    # Enter the line for a kiosk and wait until seizing one
    des.AdvanceBlock("KioskDone", "Uniform", 2, 6)  # Do necessary job
    des.LeaveBlock("LeaveKiosk", "Kiosks", 1)  # Leave the kiosk
    des.LeaveQueueBlock("LeaveKioskQue", "KioskQue")
    des.TransferBlock("NeedsTellerAssistance", 40, "Teller")
    # Does the person still needs help from a teller if so go to teller
    des.TerminateBlock("LeaveTheBankUsingKiosk", 1)  # If not leave the bank

    des.QueueBlock("TellerQue")
    des.EnterBlock("Teller", "Tellers", 1)
    # Enter the line for a Teller and wait until seizing one
    des.AdvanceBlock("TellerWait", "Uniform", 2, 6)  # Do necessary job
    des.LeaveBlock("LeaveTeller", "Tellers", 1)  # Leave the teller
    des.LeaveQueueBlock("LeaveTellerQue", "TellerQue")

    des.TerminateBlock("LeaveBankUsingTeller", 1)  # Leave the bank
    des.set_terminate(20)  # Bank closes after 50 people is done
    des.simulate()
예제 #2
0
def nodelay_generate_test_with_invalid_limit():
    print("NoDelayGenerate_Test")
    des.state.clear()
    des.debug(False)
    des.GenerateBlock('NoDelay', -2)  # 0
    des.TerminateBlock(1)  # 2

    des.set_terminate(5)

    des.simulate()
예제 #3
0
def terminate_block_test_with_valid_limit():
    print("TerminateBlock_Test_With_Valid_Limit")
    des.state.clear()
    des.debug(False)
    des.GenerateBlock('NoDelay', 5)  # 0
    des.TerminateBlock(2)  # 2

    des.set_terminate(5)

    des.simulate()
예제 #4
0
def empirical_generate_test_valid_file():
    print("EmpiricalGenerate_Test_Valid_File")
    des.state.clear()
    des.debug(False)
    des.GenerateBlock('Empirical', "distru.txt", False)  # 0
    des.TerminateBlock(1)  # 2

    des.set_terminate(5)

    des.simulate()
예제 #5
0
def uniform_generate_test():
    print("UniformGenerate_Test")
    des.state.clear()
    des.debug(False)
    des.GenerateBlock('Uniform', 5.5, 12.3, 1.5)  # 0
    des.TerminateBlock(1)  # 2

    des.set_terminate(5)

    des.simulate()
예제 #6
0
def transferblock_test_with_nothing_passing():
    print("TransferBlock_Test_With_Nothing_Passing")
    des.state.clear()
    des.debug(False)
    des.GenerateBlock('Uniform', 5, 5, 1.2)  # 0
    des.TransferBlock(0, 3)  # 1
    des.TerminateBlock(2)  # 2
    des.TerminateBlock(1)  # 3

    des.set_terminate(10)

    des.simulate()
예제 #7
0
def enterblock_test_invalid_que_size():
    print("EnterBlockTest_Invalid_Que_Size")
    des.state.clear()
    des.debug(False)
    des.GenerateBlock('Uniform', 2, 2, 1.2)  # 0
    des.EnterBlock("Depot", -2)  # 1
    des.AdvanceBlock('Uniform', 10, 10)  # 2
    des.LeaveBlock("Depot")  # 3
    des.TerminateBlock(1)  # 4

    des.set_terminate(10)
    des.simulate()
예제 #8
0
def enterblock_test_valid_que_size():
    print("EnterBlockTest_Valid_Que_Size")
    des.state.clear()
    des.debug(True)
    des.GenerateBlock('Uniform', 2, 2, 1.2)  # 0
    des.EnterBlock("Depot", 1)  # 1
    des.AdvanceBlock('Uniform', 5, 5)  # 2
    des.LeaveBlock("Depot")  # 3
    des.TerminateBlock(1)  # 4

    des.set_terminate(2)

    des.simulate()
예제 #9
0
def queue_block():
    print("Queue_Block")
    des.clear()
    des.debug(True)

    des.GenerateBlock('UniformCreator', 'Uniform', 1, 1, 1.2)
    des.QueueBlock('QueWait')
    des.AdvanceBlock('Uniform', 'Uniform', 1, 25)
    des.LeaveQueueBlock('QueWaitLeave', 'QueWait')
    des.TerminateBlock('Terminator', 1)

    des.set_terminate(12)

    des.simulate()
예제 #10
0
def turnstile():
    des.clear()
    in_use = 5
    in_range = 3
    des.Storage("Turnstile", 1)

    des.GenerateBlock("GeneratePeople", "Uniform", 0, 14)
    des.EnterBlock("TurnstileEnter", "Turnstile", 1)
    des.AdvanceBlock("TurnstileWait", "Uniform", in_use - in_range,
                     in_use + in_range)
    des.LeaveBlock("LeaveTurnstile", "Turnstile", 1)
    des.TerminateBlock("PeopleEntered", 1)
    des.set_terminate(300)

    des.simulate()
예제 #11
0
def split_block():
    print("Split_Block_With_Displace_Assemble")
    des.clear()
    des.debug(True)

    des.GenerateBlock('Uniform', 25, 25, 1.2)  # 0
    des.SplitBlock(2, 4)
    des.AdvanceBlock('Uniform', 3, 3)  # 1
    des.AssembleBlock()  # 2
    des.AdvanceBlock('Uniform', 5, 5)  # 1
    des.TerminateBlock(1)  # 3

    des.set_terminate(2)

    des.simulate()
예제 #12
0
def gasstation():
    des.clear()
    des.debug(True)

    des.Storage("GasStation", 5)  # Set Pump count to 5
    des.Storage("Cashier", 2)  # Set Cashier count to 2
    des.Storage("FuelTank", 100)
    des.Storage("FuelTruck", 1)

    des.GenerateBlock("GenerateUniformOne", "Uniform", 5, 12.3,
                      1.5)  # 0 Cars arrive between 5.5 and 12.3 seconds
    des.EnterBlock(
        "GasStationEnter", "GasStation", 1
    )  # 1 Cars Enter gas station which has 5 gas pumps so sixth car must wait
    des.EnterBlock(
        "FuelTankEnter", "FuelTank", 20, "LeaveGasStation"
    )  # 2 car takes  fuel from station tank if fuel is low at the station car moves out from the station
    des.AdvanceBlock(
        "FillGasStation", "Uniform", 5, 15
    )  # 3 Filling the gas tank of a vehicle takes between 5 and 15 seconds
    des.EnterBlock(
        "CashierEnter", "Cashier", 1
    )  # 4 After filling gas tank car owner must enter the line for payment
    des.AdvanceBlock("MakePayment", "Uniform", 3,
                     10)  # 5 Payment takes between 3 and 10 seconds
    des.LeaveBlock("LeaveCashier", "Cashier",
                   1)  # 6 After paying owner leaves the cashier line
    des.LeaveBlock("LeaveGasStation", "GasStation",
                   1)  # 7 After all owner leaves the station
    des.TerminateBlock("TerminateCar", 1)  # 8 Car destroyed

    des.LeaveBlock(
        "LeaveGasStation", "GasStation", 1
    )  # 9 Car left the station without ever getting gas and calls the fuel truck
    des.EnterBlock(
        "FuelTruckEnter", "FuelTruck", 1, "TerminateFuelTruck"
    )  # 10 Car calls the fuel truck  but there  is only  one truck
    des.AdvanceBlock("FuelTruckArrive", "Uniform", 10,
                     20)  # 11  It takes the truck 10 to 20 seconds to arrive
    des.LeaveBlock("LeaveFuelTank", "FuelTank",
                   200)  # 12 Fuel truck fills the tanks
    des.LeaveBlock("LeaveFuelTruck", "FuelTruck",
                   1)  # 13 Fuel truck returns to base
    des.TerminateBlock("TerminateFuelTruck", 0)  # 14

    des.set_terminate(7)

    des.simulate()
예제 #13
0
def carwash():
    des.clear()
    des.debug(True)

    des.Storage("Carwash", 2)
    # There is only two carwash slot
    des.GenerateBlock("GenerateCars", "Uniform", 0, 5)
    # Cars get in the carwash every 0 to 5 minutes
    des.EnterBlock("CarwashEnter", "Carwash", 1)
    # Car enters the carwash
    des.AdvanceBlock("WashCar", "Uniform", 15, 15)
    # A Car takes 15 minutes to wash
    des.LeaveBlock("LeaveCarwash", "Carwash", 1)
    # Car leaves the carwash
    des.TerminateBlock("CarLeft", 1)
    # Car leaves the simulation
    des.set_terminate(6)
    # Stop the simulation after 6  Cars Left

    des.simulate()