本文整理汇总了Python中dream.simulation.imports.Exit类的典型用法代码示例。如果您正苦于以下问题:Python Exit类的具体用法?Python Exit怎么用?Python Exit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Exit类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getEntity
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
示例2: range
for buffer in possiblePredecessors:
if not buffer==machine.previous[0]:
machine.previous[0]=buffer
break
# if canDispose is not triggered in the predecessor send it
if not machine.previous[0].canDispose.triggered:
# a succeed function on an event must always take attributes the transmitter and the time of the event
succeedTuple=(machine, G.env.now)
machine.previous[0].canDispose.succeed(succeedTuple)
print G.env.now, 'from now on the machine will take from', machine.previous[0].id
#define the objects of the model
Q1=Queue('Q1','Queue1', capacity=float('inf'))
Q2=Queue('Q2','Queue2', capacity=float('inf'))
M=Machine('M1','Machine', processingTime={'Fixed':{'mean':3}})
E=Exit('E1','Exit')
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])
示例3: main
from dream.simulation.imports import Machine, Source, Exit, Part, G, Repairman, Queue, Failure
from dream.simulation.imports import simulate, activate, initialize
#define the objects of the model
R=Repairman('R1', 'Bob')
S=Source('S1','Source', interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
M1=Machine('M1','Machine1', processingTime={'distributionType':'Fixed','mean':0.25})
Q=Queue('Q1','Queue')
M2=Machine('M2','Machine2', processingTime={'distributionType':'Fixed','mean':1.5})
E=Exit('E1','Exit')
#create failures
F1=Failure(victim=M1, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5}, repairman=R)
F2=Failure(victim=M2, distribution={'distributionType':'Fixed','MTTF':40,'MTTR':10}, repairman=R)
G.ObjList=[S,M1,M2,E,Q] #add all the objects in G.ObjList so that they can be easier accessed later
G.MachineList=[M1,M2]
G.ObjectInterruptionList=[F1,F2] #add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
S.defineRouting([M1])
M1.defineRouting([S],[Q])
Q.defineRouting([M1],[M2])
M2.defineRouting([Q],[E])
E.defineRouting([M2])
def main():
initialize() #initialize the simulation (SimPy method)
#initialize all the objects
示例4: main
from dream.simulation.imports import Machine, Source, Exit, Batch, BatchDecomposition,\
BatchSource, BatchReassembly, Queue, LineClearance, ExcelHandler, ExcelHandler
from dream.simulation.Globals import runSimulation
# define the objects of the model
S=BatchSource('S','Source',interArrivalTime={'Fixed':{'mean':1.5}}, entity='Dream.Batch', batchNumberOfUnits=100)
Q=Queue('Q','StartQueue',capacity=100000)
BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, processingTime={'Fixed':{'mean':1}})
M1=Machine('M1','Machine1',processingTime={'Fixed':{'mean':0.5}})
Q1=LineClearance('Q1','Queue1',capacity=2)
M2=Machine('M2','Machine2',processingTime={'Fixed':{'mean':4}})
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
示例5: main
from dream.simulation.imports import Machine, Source, Exit, Part, Frame, Assembly, Failure
from dream.simulation.Globals import runSimulation
#define the objects of the model
Frame.capacity=4
Sp=Source('SP','Parts', interArrivalTime={'Fixed':{'mean':0.5}}, entity='Dream.Part')
Sf=Source('SF','Frames', interArrivalTime={'Fixed':{'mean':2}}, entity='Dream.Frame')
M=Machine('M','Machine', processingTime={'Fixed':{'mean':0.25}})
A=Assembly('A','Assembly', processingTime={'Fixed':{'mean':2}})
E=Exit('E1','Exit')
F=Failure(victim=M, distribution={'TTF':{'Fixed':{'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
示例6: postProcessing
def postProcessing(self):
Exit.postProcessing(self, MaxSimtime=maxSimTime)
self.GoodExits.append(self.numGoodParts)
示例7: getEntity
def getEntity(self):
activeEntity=Exit.getEntity(self)
if activeEntity.status=='Good':
self.numGoodParts+=1
return activeEntity
示例8: initialize
def initialize(self):
self.numGoodParts=0
Exit.initialize(self)