from manpy.simulation.imports import Machine, Source, Exit, Part, ShiftScheduler from manpy.simulation.Globals import runSimulation # define the objects of the model S = Source( "S1", "Source", interArrivalTime={"Fixed": {"mean": 0.5}}, entity="manpy.Part" ) M = Machine("M1", "Machine", processingTime={"Fixed": {"mean": 3}}) E = Exit("E1", "Exit") SS = ShiftScheduler(victim=M, shiftPattern=[[0, 5], [10, 15]]) # define predecessors and successors for the objects S.defineRouting(successorList=[M]) M.defineRouting(predecessorList=[S], successorList=[E]) E.defineRouting(predecessorList=[M]) def main(test=0): # add all the objects in a list objectList = [S, M, E, SS] # set the length of the experiment maxSimTime = 20.0 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime) # calculate metrics working_ratio = (M.totalWorkingTime / maxSimTime) * 100 off_shift_ratio = (M.totalOffShiftTime / maxSimTime) * 100
M2 = InternalProcess("M2", "M2", processingTime={"Exp": {"mean": 1}}) Q3 = InternalQueue("Q3", "Q3", capacity=1) M3 = InternalProcess("M3", "M3", processingTime={"Exp": {"mean": 1}}) QA = Queue("QA", "QueueAfter", capacity=float("inf")) MA = Machine("MA", "MachineAfter", processingTime={"Exp": {"mean": 1}}) E = Exit("E", "Exit") QB.defineRouting(successorList=[Q1, Q2, Q3]) Q1.defineRouting(predecessorList=[QB], successorList=[M1]) Q2.defineRouting(predecessorList=[QB], successorList=[M2]) Q3.defineRouting(predecessorList=[QB], successorList=[M3]) M1.defineRouting(predecessorList=[Q1], successorList=[QA]) M2.defineRouting(predecessorList=[Q2], successorList=[QA]) M3.defineRouting(predecessorList=[Q3], successorList=[QA]) QA.defineRouting(predecessorList=[M1, M2, M3], successorList=[MA]) MA.defineRouting(predecessorList=[QA], successorList=[E]) E.defineRouting(predecessorList=[MA]) P1 = Part("P1", "P1", currentStation=QB) P2 = Part("P2", "P2", currentStation=QB) P3 = Part("P3", "P3", currentStation=QB) P4 = Part("P4", "P4", currentStation=QB) P5 = Part("P5", "P5", currentStation=QB) P6 = Part("P6", "P6", currentStation=QB) G.InternalQueueList = [Q1, Q2, Q3] G.InternalProcessList = [M1, M2, M3] def main(test=0): # call the runSimulation giving the objects and the length of the experiment
BRA = BatchReassembly( "BRA", "BatchReassembly", numberOfSubBatches=4, processingTime={"Fixed": { "mean": 0 }}, ) M3 = Machine("M3", "Machine3", processingTime={"Fixed": {"mean": 1}}) E = Exit("E", "Exit") # define the predecessors and successors for the objects S.defineRouting([Q]) Q.defineRouting([S], [BD]) BD.defineRouting([Q], [M1]) M1.defineRouting([BD], [Q1]) Q1.defineRouting([M1], [M2]) M2.defineRouting([Q1], [BRA]) BRA.defineRouting([M2], [M3]) M3.defineRouting([BRA], [E]) E.defineRouting([M3]) def main(test=0): # add all the objects in a list objectList = [S, Q, BD, M1, Q1, M2, BRA, M3, E] # set the length of the experiment maxSimTime = 1440.0 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime)
S = Source( "S", "Source", interArrivalTime={"Fixed": {"mean": 0.5}}, entity="manpy.Part" ) Q = Queue("Q", "Queue", capacity=float("inf")) M1 = Machine("M1", "Milling1", processingTime={"Fixed": {"mean": 0.25}}) M2 = Machine("M2", "Milling2", processingTime={"Fixed": {"mean": 0.25}}) E = Exit("E1", "Exit") F = Failure( victim=M1, distribution={"TTF": {"Fixed": {"mean": 60.0}}, "TTR": {"Fixed": {"mean": 5.0}}}, ) # define predecessors and successors for the objects S.defineRouting([Q]) Q.defineRouting([S], [M1, M2]) M1.defineRouting([Q], [E]) M2.defineRouting([Q], [E]) E.defineRouting([M1, M2]) def main(test=0): # add all the objects in a list objectList = [S, Q, M1, M2, E, F] # set the length of the experiment maxSimTime = 1440.0 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime) # calculate metrics working_ratio_M1 = (M1.totalWorkingTime / maxSimTime) * 100
"mean": 60.0 } }, "TTR": { "Fixed": { "mean": 5.0 } } }, ) # define predecessors and successors for the objects Sp.defineRouting([A]) Sf.defineRouting([A]) A.defineRouting([Sp, Sf], [M]) M.defineRouting([A], [E]) E.defineRouting([M]) def main(test=0): # add all the objects in a list objectList = [Sp, Sf, M, A, E, F] # set the length of the experiment maxSimTime = 1440.0 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime) # calculate metrics working_ratio = (A.totalWorkingTime / maxSimTime) * 100 # return results for the test
P1 = Part("P1", "Part1", currentStation=Q1) entityList = [] for i in range(5): # create the WIP in a loop Q1PartId = "Q1_P" + str(i) Q1PartName = "Q1_Part" + str(i) PQ1 = Part(Q1PartId, Q1PartName, currentStation=Q1) entityList.append(PQ1) Q2PartId = "Q2_P" + str(i) Q2PartName = "Q2_Part" + str(i) PQ2 = Part(Q2PartId, Q2PartName, currentStation=Q2) entityList.append(PQ2) # define predecessors and successors for the objects Q1.defineRouting(successorList=[M]) Q2.defineRouting(successorList=[M]) M.defineRouting(successorList=[E]) E.defineRouting(predecessorList=[M]) EV = EventGenerator( "EV", "PredecessorChanger", start=0, stop=50, interval=10, method=changeMachinePredecessor, argumentDict={"machine": M, "possiblePredecessors": [Q1, Q2]}, ) def main(test=0): # add all the objects in a list
) from manpy.simulation.Globals import runSimulation # define the objects of the model NS = NonStarvingEntry("NS1", "Entry", entityData={"_class": "manpy.Part"}) M1 = Machine("M1", "Machine1", processingTime={"Exp": {"mean": 1}}) Q2 = Queue("Q2", "Queue2") M2 = Machine("M2", "Machine2", processingTime={"Exp": {"mean": 3}}) Q3 = Queue("Q3", "Queue3") M3 = Machine("M3", "Machine3", processingTime={"Exp": {"mean": 5}}) E = Exit("E1", "Exit") # define predecessors and successors for the objects NS.defineRouting(successorList=[M1]) M1.defineRouting(predecessorList=[NS], successorList=[Q2]) Q2.defineRouting(predecessorList=[M1], successorList=[M2]) M2.defineRouting(predecessorList=[Q2], successorList=[Q3]) Q3.defineRouting(predecessorList=[M2], successorList=[M3]) M3.defineRouting(predecessorList=[Q3], successorList=[E]) E.defineRouting(predecessorList=[M3]) def main(test=0): # add all the objects in a list objectList = [NS, M1, M2, M3, Q2, Q3, E] # set the length of the experiment maxSimTime = 480 solutionList = []
) Q = Queue("Q", "StartQueue", capacity=100000) BD = BatchDecomposition( "BC", "BatchDecomposition", numberOfSubBatches=4, processingTime={"Fixed": {"mean": 1}}, ) M = Machine("M", "Machine", processingTime={"Fixed": {"mean": 0.5}}) E = Exit("E", "Exit") # define the predecessors and successors for the objects S.defineRouting([Q]) Q.defineRouting([S], [BD]) BD.defineRouting([Q], [M]) M.defineRouting([BD], [E]) E.defineRouting([M]) def main(test=0): # add all the objects in a list objectList = [S, Q, BD, M, E] # set the length of the experiment maxSimTime = 1440.0 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime) # calculate metrics working_ratio = (M.totalWorkingTime / maxSimTime) * 100 blockage_ratio = (M.totalBlockageTime / maxSimTime) * 100