def getEntity(self): activeEntity = Exit.getEntity( self) # call the parent method to get the entity # check the attribute and update the counters accordingly if activeEntity.machineId == "M1": G.NumM1 += 1 elif activeEntity.machineId == "M2": G.NumM2 += 1 return activeEntity # return the entity obtained
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
"mean": 1 }}, ) M1 = Machine("M1", "Machine1", processingTime={"Fixed": {"mean": 0.5}}) Q1 = Queue("Q1", "Queue1", capacity=2) M2 = Machine("M2", "Machine2", processingTime={"Fixed": {"mean": 1}}) 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
from manpy.simulation.imports import Machine, Source, Exit, Part, Queue, Failure from manpy.simulation.Globals import runSimulation # define the objects of the model 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
def postProcessing(self): Exit.postProcessing(self, MaxSimtime=maxSimTime) self.GoodExits.append(self.numGoodParts)
def getEntity(self): activeEntity = Exit.getEntity(self) if activeEntity.status == "Good": self.numGoodParts += 1 return activeEntity
def initialize(self): self.numGoodParts = 0 Exit.initialize(self)