Beispiel #1
0
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}
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
    objectList=[Q1,Q2,M,E,EV]+entityList  
    # 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/E.timeLastEntityLeft)*100
Beispiel #3
0
# 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  
    maxSimTime=1440.0
    # call the runSimulation giving the objects and the length of the experiment
    runSimulation(objectList, maxSimTime, trace='Yes')
    
Beispiel #4
0
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
    R.initialize()


    for object in G.ObjList:
        object.initialize()

    for objectInterruption in G.ObjectInterruptionList:
                    '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

    # return results for the test
Beispiel #6
0
                 'TTF': {
                     'Fixed': {
                         'mean': 40.0
                     }
                 },
                 'TTR': {
                     'Fixed': {
                         'mean': 10.0
                     }
                 }
             },
             repairman=R)

#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(test=0):

    # add all the objects in a list
    objectList = [S, M1, M2, E, Q, R, F1, F2]
    # 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
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):
Beispiel #8
0
#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
    
    # return results for the test
    if test:
Beispiel #9
0
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):
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
    maxSimTime = 1440.0
    # call the runSimulation giving the objects and the length of the experiment
    runSimulation(objectList, maxSimTime, trace='Yes')
Beispiel #11
0
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):
Beispiel #12
0
#     A source to generate students
#     A Queue for students to wait for a flight
#     A machine (aircraft) to give students time
#     An exit for graduated students

# The source is API for Aviation Preflight Indocrination
API = Source('API', 'Source', interArrivalTime={'Fixed': {'mean': 0.5}},
             entity='Dream.Part')
RR = Queue('ReadyRoom', 'Queue', capacity=1)
AC = Machine('AC1', 'Machine', processingTime={'Fixed': {'mean': 0.25}})
E = Exit('The Fleet', 'The Fleet')

# The predecessors and successors for the objects
API.defineRouting(successorList=[RR])
RR.defineRouting(predecessorList=[API], successorList=[AC])
AC.defineRouting(predecessorList=[RR], successorList=[E])
E.defineRouting(predecessorList=[AC])

def main(test=0):
    # add all the objects in a list
    objectList=[API, RR, AC, 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 = (AC.totalWorkingTime/maxSimTime) * 100

    # return results for the test
from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDecomposition, Queue, G 
from dream.simulation.imports import simulate, activate, initialize

# define the objects of the model
S=BatchSource('S','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Batch', batchNumberOfUnits=4)
Q=Queue('Q','StartQueue',capacity=100000)
BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, processingTime={'distributionType':'Fixed','mean':1})
M=Machine('M','Machine',processingTime={'distributionType':'Fixed','mean':0.5})
E=Exit('E','Exit')
# add all the objects in the G.ObjList so that they can be easier accessed later
G.ObjList=[S,Q,BD,M,E]
# 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():
    # initialize the simulation (SimPy method)
    initialize()
    # initialize all the objects
    for object in G.ObjList:
        object.initialize()
    # activate all the objects
    for object in G.ObjList:
        activate(object,object.run())
    # set G.maxSimTime 1440.0 minutes (1 day)
    G.maxSimTime=1440.0
    # run the simulation
    simulate(until=G.maxSimTime)
                batchNumberOfUnits=4)
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
Beispiel #15
0
# The source is API for Aviation Preflight Indocrination
API = Source('API',
             'Source',
             interArrivalTime={'Fixed': {
                 'mean': 0.5
             }},
             entity='Dream.Part')
RR = Queue('ReadyRoom', 'Queue', capacity=1)
AC = Machine('AC1', 'Machine', processingTime={'Fixed': {'mean': 0.25}})
E = Exit('The Fleet', 'The Fleet')

# The predecessors and successors for the objects
API.defineRouting(successorList=[RR])
RR.defineRouting(predecessorList=[API], successorList=[AC])
AC.defineRouting(predecessorList=[RR], successorList=[E])
E.defineRouting(predecessorList=[AC])


def main(test=0):
    # add all the objects in a list
    objectList = [API, RR, AC, 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 = (AC.totalWorkingTime / maxSimTime) * 100