Exemplo n.º 1
0
from dream.simulation.imports import Machine, Source, Exit, Part, ShiftScheduler 
from dream.simulation.Globals import runSimulation

#define the objects of the model 
S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':3})
E=Exit('E1','Exit')  

# create a repeated shift pattern
shiftPattern=[]
i = 0 
while i<100:
    shiftPattern.append([i,i+5])
    i+=10
print shiftPattern

#create the shift
SS=ShiftScheduler(victim=M, shiftPattern=shiftPattern) 

#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=100.0
    # call the runSimulation giving the objects and the length of the experiment
Exemplo n.º 2
0
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,
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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
Exemplo n.º 5
0
        part.machineId=self.id                      #create an attribute to the obtained part and give it the value of the object's id
        return activeEntity                         #return the entity obtained

#the custom exit
class CountingExit(Exit):
    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
        
#define the objects of the model
S=Source('S','Source', interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
Q=SelectiveQueue('Q','Queue', capacity=infinity)
M1=Milling('M1','Milling1', processingTime={'distributionType':'Fixed','mean':0.25})
M2=Milling('M2','Milling2', processingTime={'distributionType':'Fixed','mean':0.25})
E=CountingExit('E1','Exit')  

F=Failure(victim=M1, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5})

G.ObjList=[S,Q,M1,M2,E]   #add all the objects in G.ObjList so that they can be easier accessed later

G.ObjectInterruptionList=[F]     #add all the objects in G.ObjList so that they can be easier accessed later

#create the global counter variables
G.NumM1=0
G.NumM2=0
Exemplo n.º 6
0
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
    
Exemplo n.º 7
0
from dream.simulation.imports import Source, Queue, Machine, Exit
from dream.simulation.Globals import runSimulation

# This is the baby step to building a complicated model of the behavior
# of a fleet of systems with multiple stakeholders.
# The baby step includes:
#     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
Exemplo n.º 8
0
from dream.simulation.imports import Source, Queue, Machine, Exit
from dream.simulation.Globals import runSimulation

# This is the baby step to building a complicated model of the behavior
# of a fleet of systems with multiple stakeholders.
# The baby step includes:
#     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