from dream.simulation.imports import Machine, Queue, Exit, Part, ExcelHandler from dream.simulation.Globals import runSimulation, G #define the objects of the model Q=Queue('Q1','Queue', capacity=1) M=Machine('M1','Machine', processingTime={'Fixed':{'mean':0.25}}) E=Exit('E1','Exit') P1=Part('P1', 'Part1', currentStation=Q) #define predecessors and successors for the objects Q.defineRouting(successorList=[M]) M.defineRouting(predecessorList=[Q],successorList=[E]) E.defineRouting(predecessorList=[M]) def main(test=0): # add all the objects in a list objectList=[Q,M,E,P1] # set the length of the experiment maxSimTime=float('inf') # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime, trace='Yes') # calculate metrics working_ratio = (M.totalWorkingTime/G.maxSimTime)*100 # return results for the test if test: return {"parts": E.numOfExits, "simulationTime":E.timeLastEntityLeft, "working_ratio": working_ratio}
from dream.simulation.imports import Machine, Source, Exit, Part, Repairman, Queue, Failure from dream.simulation.Globals import runSimulation #define the objects of the model R = Repairman('R1', 'Bob') S = Source('S1', 'Source', interarrivalTime={'Exp': { 'mean': 0.5 }}, entity='Dream.Part') M1 = Machine('M1', 'Machine1', processingTime={ 'Normal': { 'mean': 0.25, 'stdev': 0.1, 'min': 0.1, 'max': 1 } }) M2 = Machine('M2', 'Machine2', processingTime={ 'Normal': { 'mean': 1.5, 'stdev': 0.3, 'min': 0.5, 'max': 5 } }) Q = Queue('Q1', 'Queue')
from dream.simulation.imports import Machine, Source, Exit, Part, Repairman, Queue, Failure from dream.simulation.Globals import runSimulation #define the objects of the model R = Repairman('R1', 'Bob') S = Source('S1', 'Source', interArrivalTime={'Fixed': { 'mean': 0.5 }}, entity='Dream.Part') M1 = Machine('M1', 'Machine1', processingTime={'Fixed': {'mean': 0.25}}) Q = Queue('Q1', 'Queue') M2 = Machine('M2', 'Machine2', processingTime={'Fixed': {'mean': 1.5}}) E = Exit('E1', 'Exit') #create failures F1 = Failure(victim=M1, distribution={ 'TTF': { 'Fixed': { 'mean': 60.0 } }, 'TTR': { 'Fixed': { 'mean': 5.0 } } }, repairman=R) F2 = Failure(victim=M2,
from dream.simulation.imports import Machine, Source, Exit, Part, Queue, NonStarvingEntry from dream.simulation.Globals import runSimulation #define the objects of the model NS = NonStarvingEntry('NS1', 'Entry', entityData={'_class': 'Dream.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 = [] for i in range(1, 10):
# 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])
if possibleReceivers[0].canAccept(): return possibleReceivers[0] elif possibleReceivers[1].canAccept(): return possibleReceivers[1] return None #define the objects of the model S = Source('S', 'Source', interArrivalTime={'Fixed': { 'mean': 0.5 }}, entity='Dream.Part') Q = SelectiveQueue('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 } } })
def countInternalParts(self): totalParts = 0 for object in G.InternalProcessList + G.InternalQueueList: totalParts += len(object.getActiveObjectQueue()) return totalParts QB = Queue('QB', 'QueueBefore', capacity=float("inf")) Q1 = InternalQueue('Q1', 'Q1', capacity=1) M1 = InternalProcess('M1', 'M1', processingTime={'Exp': {'mean': 1}}) Q2 = InternalQueue('Q2', 'Q2', capacity=1) 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)
#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': 1}}) 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 } }