Commit f11bf8f5 authored by Georgios Dagkakis's avatar Georgios Dagkakis

Examples updated to matchnew notations. TODOS: create tests and update...

Examples updated to matchnew notations. TODOS: create tests and update BatchDecomposition/Reassembly distribution definitions
parent 74769aa1
......@@ -54,5 +54,5 @@ def main():
"working_ratio": working_ratio}
if __name__ == '__main__':
main()
main()
......@@ -5,14 +5,14 @@ from dream.simulation.imports import simulate, activate, initialize
# choose to output trace or not
G.trace='Yes'
# define the objects of the model
S=BatchSource('S','Source',mean=1.5, entity='Dream.Batch', batchNumberOfUnits=100)
Q=Queue('Q','StartQueue',capacity=-1)
S=BatchSource('S','Source',interarrivalTime={'distributionType':'Fixed','mean':1.5}, entity='Dream.Batch', batchNumberOfUnits=100)
Q=Queue('Q','StartQueue',capacity=100000)
BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, mean=1)
M1=Machine('M1','Machine1',mean=0.5)
M1=Machine('M1','Machine1',processingTime={'distributionType':'Fixed','mean':0.5})
Q1=LineClearance('Q1','Queue1',capacity=2)
M2=Machine('M2','Machine2',mean=4)
M2=Machine('M2','Machine2',processingTime={'distributionType':'Fixed','mean':4})
BRA=BatchReassembly('BRA', 'BatchReassembly', numberOfSubBatches=4, mean=0)
M3=Machine('M3','Machine3',mean=1)
M3=Machine('M3','Machine3',processingTime={'distributionType':'Fixed','mean':1})
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,M1,Q1,M2,BRA,M3,E]
......@@ -26,31 +26,55 @@ M2.defineRouting([Q1],[BRA])
BRA.defineRouting([M2],[M3])
M3.defineRouting([BRA],[E])
E.defineRouting([M3])
# 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)
# carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
# print trace
ExcelHandler.outputTrace('Trace')
# print the results
print "the system produced", E.numOfExits, "parts"
print "the working ratio of", M1.objName, "is", (M1.totalWorkingTime/G.maxSimTime)*100
print "the blockage ratio of", M1.objName, 'is', (M1.totalBlockageTime/G.maxSimTime)*100
print "the waiting ratio of", M1.objName, 'is', (M1.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M2.objName, "is", (M2.totalWorkingTime/G.maxSimTime)*100
print "the blockage ratio of", M2.objName, 'is', (M2.totalBlockageTime/G.maxSimTime)*100
print "the waiting ratio of", M2.objName, 'is', (M2.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M3.objName, "is", (M3.totalWorkingTime/G.maxSimTime)*100
print "the blockage ratio of", M3.objName, 'is', (M3.totalBlockageTime/G.maxSimTime)*100
print "the waiting ratio of", M3.objName, 'is', (M3.totalWaitingTime/G.maxSimTime)*100
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)
# carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
# print the results
print "the system produced", E.numOfExits, "parts"
working_ratio_M1 = (M1.totalWorkingTime/G.maxSimTime)*100
blockage_ratio_M1 = (M1.totalBlockageTime/G.maxSimTime)*100
waiting_ratio_M1 = (M1.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M1.objName, "is", working_ratio_M1
print "the blockage ratio of", M1.objName, 'is', blockage_ratio_M1
print "the waiting ratio of", M1.objName, 'is', waiting_ratio_M1
working_ratio_M2 = (M2.totalWorkingTime/G.maxSimTime)*100
blockage_ratio_M2 = (M2.totalBlockageTime/G.maxSimTime)*100
waiting_ratio_M2 = (M2.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M2.objName, "is", working_ratio_M2
print "the blockage ratio of", M2.objName, 'is', blockage_ratio_M2
print "the waiting ratio of", M2.objName, 'is', waiting_ratio_M2
working_ratio_M3 = (M3.totalWorkingTime/G.maxSimTime)*100
blockage_ratio_M3 = (M3.totalBlockageTime/G.maxSimTime)*100
waiting_ratio_M3 = (M3.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M3.objName, "is", working_ratio_M3
print "the blockage ratio of", M3.objName, 'is', blockage_ratio_M3
print "the waiting ratio of", M3.objName, 'is', waiting_ratio_M3
return {"parts": E.numOfExits,
"working_ratio_M1": working_ratio_M1,
"blockage_ratio_M1": blockage_ratio_M1,
"waiting_ratio_M1": waiting_ratio_M1,
"working_ratio_M2": working_ratio_M2,
"blockage_ratio_M2": blockage_ratio_M2,
"waiting_ratio_M2": waiting_ratio_M2,
"working_ratio_M3": working_ratio_M3,
"blockage_ratio_M3": blockage_ratio_M3,
"waiting_ratio_M3": waiting_ratio_M3,
}
if __name__ == '__main__':
main()
......@@ -2,10 +2,10 @@ from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDec
from dream.simulation.imports import simulate, activate, initialize
# define the objects of the model
S=BatchSource('S','Source',mean=0.5, entity='Dream.Batch', batchNumberOfUnits=4)
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, mean=1)
M=Machine('M','Machine',mean=0.5)
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]
......@@ -15,23 +15,35 @@ Q.defineRouting([S],[BD])
BD.defineRouting([Q],[M])
M.defineRouting([BD],[E])
E.defineRouting([M])
# 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)
# carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
# print the results
print "the system produced", E.numOfExits, "parts"
print "the working ratio of", M.objName, "is", (M.totalWorkingTime/G.maxSimTime)*100
print "the blockage ratio of", M.objName, 'is', (M.totalBlockageTime/G.maxSimTime)*100
print "the waiting ratio of", M.objName, 'is', (M.totalWaitingTime/G.maxSimTime)*100
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)
# carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
# print the results
print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/G.maxSimTime)*100
blockage_ratio = (M.totalBlockageTime/G.maxSimTime)*100
waiting_ratio = (M.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M.objName, "is", working_ratio
print "the blockage ratio of", M.objName, 'is', blockage_ratio
print "the waiting ratio of", M.objName, 'is', waiting_ratio
return {"parts": E.numOfExits,
"working_ratio": working_ratio,
"blockage_ratio": blockage_ratio,
"waiting_ratio": waiting_ratio}
if __name__ == '__main__':
main()
......@@ -23,31 +23,32 @@ J1Route=[{"stationIdsList": ["Q1"]},
#define the Jobs
J=Job('J1','Job1',route=J1Route)
G.EntityList=[J] #a list to hold all the jobs
initialize() #initialize the simulation (SimPy method)
#initialize all the objects
for object in G.ObjList:
object.initialize()
J.initialize()
#set the WIP
Globals.setWIP(G.EntityList)
def main():
initialize() #initialize the simulation (SimPy method)
#initialize all the objects
for object in G.ObjList:
object.initialize()
J.initialize()
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
simulate(until=infinity) #run the simulation until there are no more events
G.maxSimTime=E.timeLastEntityLeft #calculate the maxSimTime as the time that the last Job left
#set the WIP
Globals.setWIP(G.EntityList)
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
simulate(until=infinity) #run the simulation until there are no more events
G.maxSimTime=E.timeLastEntityLeft #calculate the maxSimTime as the time that the last Job left
#loop in the schedule to print the results
returnSchedule=[] # dummy variable used just for returning values and testing
for record in J.schedule:
returnSchedule.append([record[0].objName,record[1]])
print J.name, "got into", record[0].objName, "at", record[1]
return returnSchedule
#loop in the schedule to print the results
for record in J.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name=None
for obj in G.ObjList:
if obj is record[0]:
name=obj.objName
print J.name, "got into", name, "at", record[1]
\ No newline at end of file
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -26,33 +26,36 @@ J1Route=[{"stationIdsList": ["Q1"]},
J=Job('J1','Job1',route=J1Route)
G.EntityList=[J] #a list to hold all the jobs
initialize() #initialize the simulation (SimPy method)
def main():
initialize() #initialize the simulation (SimPy method)
#initialize all the objects
for object in G.ObjList:
object.initialize()
J.initialize()
#set the WIP
Globals.setWIP(G.EntityList)
#initialize all the objects
for object in G.ObjList:
object.initialize()
J.initialize()
#set the WIP
Globals.setWIP(G.EntityList)
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
simulate(until=infinity) #run the simulation until there are no more events
G.maxSimTime=E.timeLastEntityLeft #calculate the maxSimTime as the time that the last Job left
#loop in the schedule to print the results
for record in J.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name=None
for obj in G.ObjList:
if obj is record[0]:
name=obj.objName
print J.name, "got into", name, "at", record[1]
simulate(until=infinity) #run the simulation until there are no more events
G.maxSimTime=E.timeLastEntityLeft #calculate the maxSimTime as the time that the last Job left
#loop in the schedule to print the results
schedule=[]
for record in J.schedule:
schedule.append([record[0].objName,record[1]])
print J.name, "got into", record[0].objName, "at", record[1]
ExcelHandler.outputTrace('TRACE')
return schedule
if __name__ == '__main__':
main()
ExcelHandler.outputTrace('TRACE')
......@@ -48,34 +48,38 @@ J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110)
G.JobList=[J1,J2,J3] #a list to hold all the jobs
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
def main():
initialize() #initialize the simulation (SimPy method)
#initialize all the objects
for object in G.ObjList:
object.initialize()
#initialize all the jobs
for job in G.JobList:
job.initialize()
initialize() #initialize the simulation (SimPy method)
#set the WIP for all the jobs
Globals.setWIP(G.JobList)
#initialize all the objects
for object in G.ObjList:
object.initialize()
#initialize all the jobs
for job in G.JobList:
job.initialize()
#set the WIP for all the jobs
Globals.setWIP(G.JobList)
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
simulate(until=G.maxSimTime) #run the simulation
#output the schedule of every job
for job in G.JobList:
#loop in the schedule to print the results
for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name=None
for obj in G.ObjList:
if obj is record[0]:
name=obj.objName
print job.name, "got into", name, "at", record[1]
print "-"*30
simulate(until=G.maxSimTime) #run the simulation
#output the schedule of every job
returnSchedule=[] # dummy variable used just for returning values and testing
for job in G.JobList:
#loop in the schedule to print the results
for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name=None
returnSchedule.append([record[0].objName,record[1]])
print job.name, "got into", record[0].objName, "at", record[1]
print "-"*30
return returnSchedule
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -48,34 +48,38 @@ J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110)
G.JobList=[J1,J2,J3] #a list to hold all the jobs
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
def main():
initialize() #initialize the simulation (SimPy method)
#initialize all the objects
for object in G.ObjList:
object.initialize()
#initialize all the jobs
for job in G.JobList:
job.initialize()
initialize() #initialize the simulation (SimPy method)
#set the WIP for all the jobs
Globals.setWIP(G.JobList)
#initialize all the objects
for object in G.ObjList:
object.initialize()
#initialize all the jobs
for job in G.JobList:
job.initialize()
#set the WIP for all the jobs
Globals.setWIP(G.JobList)
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
simulate(until=G.maxSimTime) #run the simulation
#output the schedule of every job
for job in G.JobList:
#loop in the schedule to print the results
for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name=None
for obj in G.ObjList:
if obj is record[0]:
name=obj.objName
print job.name, "got into", name, "at", record[1]
print "-"*30
simulate(until=G.maxSimTime) #run the simulation
#output the schedule of every job
returnSchedule=[] # dummy variable used just for returning values and testing
for job in G.JobList:
#loop in the schedule to print the results
for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name=None
returnSchedule.append([record[0].objName,record[1]])
print job.name, "got into", record[0].objName, "at", record[1]
print "-"*30
return returnSchedule
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -48,34 +48,38 @@ J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110)
G.JobList=[J1,J2,J3] #a list to hold all the jobs
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
def main():
initialize() #initialize the simulation (SimPy method)
#initialize all the objects
for object in G.ObjList:
object.initialize()
#initialize all the jobs
for job in G.JobList:
job.initialize()
initialize() #initialize the simulation (SimPy method)
#set the WIP for all the jobs
Globals.setWIP(G.JobList)
#initialize all the objects
for object in G.ObjList:
object.initialize()
#initialize all the jobs
for job in G.JobList:
job.initialize()
#set the WIP for all the jobs
Globals.setWIP(G.JobList)
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
simulate(until=G.maxSimTime) #run the simulation
#output the schedule of every job
for job in G.JobList:
#loop in the schedule to print the results
for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name=None
for obj in G.ObjList:
if obj is record[0]:
name=obj.objName
print job.name, "got into", name, "at", record[1]
print "-"*30
simulate(until=G.maxSimTime) #run the simulation
#output the schedule of every job
returnSchedule=[] # dummy variable used just for returning values and testing
for job in G.JobList:
#loop in the schedule to print the results
for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name=None
returnSchedule.append([record[0].objName,record[1]])
print job.name, "got into", record[0].objName, "at", record[1]
print "-"*30
return returnSchedule
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -2,7 +2,7 @@ from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop,
from dream.simulation.imports import simulate, activate, initialize, infinity
#define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=infinity, schedulingRule="LPT")
Q1=QueueJobShop('Q1','Queue1', capacity=infinity, schedulingRule="RPC")
Q2=QueueJobShop('Q2','Queue2', capacity=infinity)
Q3=QueueJobShop('Q3','Queue3', capacity=infinity)
M1=MachineJobShop('M1','Machine1')
......@@ -48,34 +48,38 @@ J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110)
G.JobList=[J1,J2,J3] #a list to hold all the jobs
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
def main():
initialize() #initialize the simulation (SimPy method)
#initialize all the objects
for object in G.ObjList:
object.initialize()
#initialize all the jobs
for job in G.JobList:
job.initialize()
initialize() #initialize the simulation (SimPy method)
#set the WIP for all the jobs
Globals.setWIP(G.JobList)
#initialize all the objects
for object in G.ObjList:
object.initialize()
#initialize all the jobs
for job in G.JobList:
job.initialize()
#set the WIP for all the jobs
Globals.setWIP(G.JobList)
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
simulate(until=G.maxSimTime) #run the simulation
#output the schedule of every job
for job in G.JobList:
#loop in the schedule to print the results
for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name=None
for obj in G.ObjList:
if obj is record[0]:
name=obj.objName
print job.name, "got into", name, "at", record[1]
print "-"*30
simulate(until=G.maxSimTime) #run the simulation
#output the schedule of every job
returnSchedule=[] # dummy variable used just for returning values and testing
for job in G.JobList:
#loop in the schedule to print the results
for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name=None
returnSchedule.append([record[0].objName,record[1]])
print job.name, "got into", record[0].objName, "at", record[1]
print "-"*30
return returnSchedule
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -2,13 +2,13 @@ from dream.simulation.imports import Machine, Source, Exit, Part, Queue, G, Fail
from dream.simulation.imports import simulate, activate, initialize, infinity
#define the objects of the model
S=Source('S','Source', mean=0.5, entity='Dream.Part')
S=Source('S','Source', interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
Q=Queue('Q','Queue', capacity=infinity)
M1=Machine('M1','Milling1', mean=0.25)
M2=Machine('M2','Milling2', mean=0.25)
M1=Machine('M1','Milling1', processingTime={'distributionType':'Fixed','mean':0.25})
M2=Machine('M2','Milling2', processingTime={'distributionType':'Fixed','mean':0.25})
E=Exit('E1','Exit')
F=Failure(victim=M1, distributionType='Fixed', MTTF=60, MTTR=5)
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
......@@ -22,32 +22,40 @@ M1.defineRouting([Q],[E])
M2.defineRouting([Q],[E])
E.defineRouting([M1,M2])
initialize() #initialize the simulation (SimPy method)
def main():
initialize() #initialize the simulation (SimPy method)
for object in G.ObjList:
object.initialize()
for objectInterruption in G.ObjectInterruptionList:
objectInterruption.initialize()
for object in G.ObjList:
object.initialize()
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
for objectInterruption in G.ObjectInterruptionList:
objectInterruption.initialize()
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
for objectInterruption in G.ObjectInterruptionList:
activate(objectInterruption, objectInterruption.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
for objectInterruption in G.ObjectInterruptionList:
activate(objectInterruption, objectInterruption.run())
simulate(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#print the results
print "the system produced", E.numOfExits, "parts"
print "the working ratio of", M1.objName, "is", (M1.totalWorkingTime/G.maxSimTime)*100, "%"
print "the working ratio of", M2.objName, "is", (M2.totalWorkingTime/G.maxSimTime)*100, "%"
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
simulate(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#print the results
print "the system produced", E.numOfExits, "parts"
working_ratio_M1=(M1.totalWorkingTime/G.maxSimTime)*100
working_ratio_M2=(M2.totalWorkingTime/G.maxSimTime)*100
print "the working ratio of", M1.objName, "is", working_ratio_M1, "%"
print "the working ratio of", M2.objName, "is", working_ratio_M2, "%"
return {"parts": E.numOfExits,
"working_ratio_M1": working_ratio_M1,
"working_ratio_M2": working_ratio_M2}
if __name__ == '__main__':
main()
......@@ -15,13 +15,13 @@ class SelectiveQueue(Queue):
return len(self.getActiveObjectQueue())>0 and (not (M1.canAccept()))
#define the objects of the model
S=Source('S','Source', mean=0.5, entity='Dream.Part')
S=Source('S','Source', interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
Q=SelectiveQueue('Q','Queue', capacity=infinity)
M1=Machine('M1','Milling1', mean=0.25)
M2=Machine('M2','Milling2', mean=0.25)
M1=Machine('M1','Milling1', processingTime={'distributionType':'Fixed','mean':0.25})
M2=Machine('M2','Milling2', processingTime={'distributionType':'Fixed','mean':0.25})
E=Exit('E1','Exit')
F=Failure(victim=M1, distributionType='Fixed', MTTF=60, MTTR=5)
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
......@@ -35,30 +35,39 @@ M1.defineRouting([Q],[E])
M2.defineRouting([Q],[E])
E.defineRouting([M1,M2])
initialize() #initialize the simulation (SimPy method)
def main():
initialize() #initialize the simulation (SimPy method)
for object in G.ObjList:
object.initialize()
for objectInterruption in G.ObjectInterruptionList:
objectInterruption.initialize()
for object in G.ObjList:
object.initialize()
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
for objectInterruption in G.ObjectInterruptionList:
objectInterruption.initialize()
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
for objectInterruption in G.ObjectInterruptionList:
activate(objectInterruption, objectInterruption.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
for objectInterruption in G.ObjectInterruptionList:
activate(objectInterruption, objectInterruption.run())
simulate(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
simulate(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#print the results
print "the system produced", E.numOfExits, "parts"
working_ratio_M1=(M1.totalWorkingTime/G.maxSimTime)*100
working_ratio_M2=(M2.totalWorkingTime/G.maxSimTime)*100
print "the working ratio of", M1.objName, "is", working_ratio_M1, "%"
print "the working ratio of", M2.objName, "is", working_ratio_M2, "%"
return {"parts": E.numOfExits,
"working_ratio_M1": working_ratio_M1,
"working_ratio_M2": working_ratio_M2}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the working ratio of", M1.objName, "is", (M1.totalWorkingTime/G.maxSimTime)*100, "%"
print "the working ratio of", M2.objName, "is", (M2.totalWorkingTime/G.maxSimTime)*100, "%"
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -34,13 +34,13 @@ class CountingExit(Exit):
return activeEntity #return the entity obtained
#define the objects of the model
S=Source('S','Source', mean=0.5, entity='Dream.Part')
S=Source('S','Source', interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
Q=SelectiveQueue('Q','Queue', capacity=infinity)
M1=Milling('M1','Milling1', mean=0.25)
M2=Milling('M2','Milling2', mean=0.25)
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, distributionType='Fixed', MTTF=60, MTTR=5)
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
......@@ -57,34 +57,43 @@ M1.defineRouting([Q],[E])
M2.defineRouting([Q],[E])
E.defineRouting([M1,M2])
initialize() #initialize the simulation (SimPy method)
def main():
initialize() #initialize the simulation (SimPy method)
for object in G.ObjList:
object.initialize()
for objectInterruption in G.ObjectInterruptionList:
objectInterruption.initialize()
for object in G.ObjList:
object.initialize()
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
for objectInterruption in G.ObjectInterruptionList:
objectInterruption.initialize()
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
for objectInterruption in G.ObjectInterruptionList:
activate(objectInterruption, objectInterruption.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
for objectInterruption in G.ObjectInterruptionList:
activate(objectInterruption, objectInterruption.run())
simulate(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#print the results
print "the system produced", E.numOfExits, "parts"
print "the working ratio of", M1.objName, "is", (M1.totalWorkingTime/G.maxSimTime)*100, "%"
print "the working ratio of", M2.objName, "is", (M2.totalWorkingTime/G.maxSimTime)*100, "%"
print M1.objName, "produced", G.NumM1, "parts"
print M2.objName, "produced", G.NumM2, "parts"
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
simulate(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#print the results
print "the system produced", E.numOfExits, "parts"
working_ratio_M1=(M1.totalWorkingTime/G.maxSimTime)*100
working_ratio_M2=(M2.totalWorkingTime/G.maxSimTime)*100
print "the working ratio of", M1.objName, "is", working_ratio_M1, "%"
print "the working ratio of", M2.objName, "is", working_ratio_M2, "%"
print M1.objName, "produced", G.NumM1, "parts"
print M2.objName, "produced", G.NumM2, "parts"
return {"parts": E.numOfExits,
"working_ratio_M1": working_ratio_M1,
"working_ratio_M2": working_ratio_M2,
"NumM1":G.NumM1,
"NumM2":G.NumM2}
if __name__ == '__main__':
main()
......@@ -2,14 +2,14 @@ from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDec
from dream.simulation.imports import simulate, activate, initialize
# define the objects of the model
S=BatchSource('S','Source',mean=1.5, entity='Dream.Batch', batchNumberOfUnits=100)
S=BatchSource('S','Source',interarrivalTime={'distributionType':'Fixed','mean':1.5}, entity='Dream.Batch', batchNumberOfUnits=100)
Q=Queue('Q','StartQueue',capacity=100000)
BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, mean=1)
M1=Machine('M1','Machine1',mean=0.5)
M1=Machine('M1','Machine1',processingTime={'distributionType':'Fixed','mean':0.5})
Q1=Queue('Q1','Queue1',capacity=2)
M2=Machine('M2','Machine2',mean=1)
M2=Machine('M2','Machine2',processingTime={'distributionType':'Fixed','mean':1})
BRA=BatchReassembly('BRA', 'BatchReassembly', numberOfSubBatches=4, mean=0)
M3=Machine('M3','Machine3',mean=1)
M3=Machine('M3','Machine3',processingTime={'distributionType':'Fixed','mean':1})
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,M1,Q1,M2,BRA,M3,E]
......@@ -23,33 +23,55 @@ M2.defineRouting([Q1],[BRA])
BRA.defineRouting([M2],[M3])
M3.defineRouting([BRA],[E])
E.defineRouting([M3])
# 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)
# carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
# print the results
print "the system produced", E.numOfExits, "parts"
# for object in G.MachineList:
# print "the working ratio of", object.objName, "is", (object.totalWorkingTime/G.maxSimTime)*100
# print "the blockage ratio of", object.objName, "is", (object.totalBlockageTime/G.maxSimTime)*100
# print "the waiting ratio of", object.objName, "is", (object.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M1.objName, "is", (M1.totalWorkingTime/G.maxSimTime)*100
print "the blockage ratio of", M1.objName, 'is', (M1.totalBlockageTime/G.maxSimTime)*100
print "the waiting ratio of", M1.objName, 'is', (M1.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M2.objName, "is", (M2.totalWorkingTime/G.maxSimTime)*100
print "the blockage ratio of", M2.objName, 'is', (M2.totalBlockageTime/G.maxSimTime)*100
print "the waiting ratio of", M2.objName, 'is', (M2.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M3.objName, "is", (M3.totalWorkingTime/G.maxSimTime)*100
print "the blockage ratio of", M3.objName, 'is', (M3.totalBlockageTime/G.maxSimTime)*100
print "the waiting ratio of", M3.objName, 'is', (M3.totalWaitingTime/G.maxSimTime)*100
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)
# carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
# print the results
print "the system produced", E.numOfExits, "parts"
working_ratio_M1 = (M1.totalWorkingTime/G.maxSimTime)*100
blockage_ratio_M1 = (M1.totalBlockageTime/G.maxSimTime)*100
waiting_ratio_M1 = (M1.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M1.objName, "is", working_ratio_M1
print "the blockage ratio of", M1.objName, 'is', blockage_ratio_M1
print "the waiting ratio of", M1.objName, 'is', waiting_ratio_M1
working_ratio_M2 = (M2.totalWorkingTime/G.maxSimTime)*100
blockage_ratio_M2 = (M2.totalBlockageTime/G.maxSimTime)*100
waiting_ratio_M2 = (M2.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M2.objName, "is", working_ratio_M2
print "the blockage ratio of", M2.objName, 'is', blockage_ratio_M2
print "the waiting ratio of", M2.objName, 'is', waiting_ratio_M2
working_ratio_M3 = (M3.totalWorkingTime/G.maxSimTime)*100
blockage_ratio_M3 = (M3.totalBlockageTime/G.maxSimTime)*100
waiting_ratio_M3 = (M3.totalWaitingTime/G.maxSimTime)*100
print "the working ratio of", M3.objName, "is", working_ratio_M3
print "the blockage ratio of", M3.objName, 'is', blockage_ratio_M3
print "the waiting ratio of", M3.objName, 'is', waiting_ratio_M3
return {"parts": E.numOfExits,
"working_ratio_M1": working_ratio_M1,
"blockage_ratio_M1": blockage_ratio_M1,
"waiting_ratio_M1": waiting_ratio_M1,
"working_ratio_M2": working_ratio_M2,
"blockage_ratio_M2": blockage_ratio_M2,
"waiting_ratio_M2": waiting_ratio_M2,
"working_ratio_M3": working_ratio_M3,
"blockage_ratio_M3": blockage_ratio_M3,
"waiting_ratio_M3": waiting_ratio_M3,
}
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -2,8 +2,8 @@ from dream.simulation.imports import Machine, Source, Exit, Part, G
from dream.simulation.imports import simulate, activate, initialize
#define the objects of the model
S=Source('S1','Source',distribution='Fixed', mean=0.5, entity='Dream.Part')
M=Machine('M1','Machine', mean=0.25)
S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':0.25})
E=Exit('E1','Exit')
G.ObjList=[S,M,E] #add all the objects in G.ObjList so that they can be easier accessed later
......@@ -13,24 +13,31 @@ S.defineRouting(successorList=[M])
M.defineRouting(predecessorList=[S],successorList=[E])
E.defineRouting(predecessorList=[M])
initialize() #initialize the simulation (SimPy method)
def main():
initialize() #initialize the simulation (SimPy method)
#initialize all the objects
for object in G.ObjList:
object.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())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
simulate(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
simulate(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#print the results
print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/G.maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%"
return {"parts": E.numOfExits,
"working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the total working ratio of the Machine is", (M.totalWorkingTime/G.maxSimTime)*100, "%"
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -65,4 +65,4 @@ def main():
"working_ratio": working_ratio}
if __name__ == '__main__':
main()
main()
......@@ -5,16 +5,16 @@ from dream.simulation.imports import simulate, activate, initialize
from dream.KnowledgeExtraction.Plots import Graphs
#define the objects of the model
R=Repairman('R1', 'Bob')
S=Source('S1','Source', mean=0.5, entity='Dream.Part')
M1=Machine('M1','Machine1', mean=0.25, failureDistribution='Fixed', MTTF=60, MTTR=5, repairman=R)
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', mean=1.5, failureDistribution='Fixed', MTTF=40, MTTR=10,repairman=R)
M2=Machine('M2','Machine2', processingTime={'distributionType':'Fixed','mean':1.5})
E=Exit('E1','Exit')
#create failures
F1=Failure(victim=M1, distributionType='Fixed', MTTF=60, MTTR=5, repairman=R)
F2=Failure(victim=M2, distributionType='Fixed', MTTF=40, MTTR=10, repairman=R)
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
......@@ -27,46 +27,55 @@ Q.defineRouting([M1],[M2])
M2.defineRouting([Q],[E])
E.defineRouting([M2])
initialize() #initialize the simulation (SimPy method)
def main():
initialize() #initialize the simulation (SimPy method)
#initialize all the objects
R.initialize()
#initialize all the objects
R.initialize()
for object in G.ObjList:
object.initialize()
for objectInterruption in G.ObjectInterruptionList:
objectInterruption.initialize()
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
for object in G.ObjList:
object.initialize()
for objectInterruption in G.ObjectInterruptionList:
objectInterruption.initialize()
#activate all the objects
for object in G.ObjList:
activate(object, object.run())
for objectInterruption in G.ObjectInterruptionList:
activate(objectInterruption, objectInterruption.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
for objectInterruption in G.ObjectInterruptionList:
activate(objectInterruption, objectInterruption.run())
simulate(until=G.maxSimTime) #run the simulation
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
R.postProcessing()
#print the results
print "the system produced", E.numOfExits, "parts"
blockage_ratio = (M1.totalBlockageTime/G.maxSimTime)*100
working_ratio = (R.totalWorkingTime/G.maxSimTime)*100
waiting_ratio = (R.totalWaitingTime/G.maxSimTime)*100
print "the blockage ratio of", M1.objName, "is", blockage_ratio, "%"
print "the working ratio of", R.objName,"is", working_ratio, "%"
#create a graph object
graph=Graphs()
#create the pie
graph.Pie([working_ratio,waiting_ratio], "repairmanPie.jpg")
return {"parts": E.numOfExits,
"blockage_ratio": blockage_ratio,
"working_ratio": working_ratio}
simulate(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
R.postProcessing()
#print the results
print "the system produced", E.numOfExits, "parts"
print "the blockage ratio of", M1.objName, "is", (M1.totalBlockageTime/G.maxSimTime)*100, "%"
print "the working ratio of", R.objName,"is", (R.totalWorkingTime/G.maxSimTime)*100, "%"
#calculate the percentages for the pie
repairmanWorkingRatio=R.totalWorkingTime/G.maxSimTime*100
repairmanWaitingRatio=R.totalWaitingTime/G.maxSimTime*100
#create a graph object
graph=Graphs()
#create the pie
graph.Pie([repairmanWorkingRatio,repairmanWaitingRatio], "repairmanPie.jpg")
if __name__ == '__main__':
main()
......@@ -3,15 +3,15 @@ from dream.simulation.imports import simulate, activate, initialize
#define the objects of the model
R=Repairman('R1', 'Bob')
S=Source('S1','Source', mean=0.5, entity='Dream.Part')
M1=Machine('M1','Machine1', distribution='Normal', mean=0.25, stdev=0.1, min=0.1, max=1)
S=Source('S1','Source', interarrivalTime={'distributionType':'Exp','mean':0.5}, entity='Dream.Part')
M1=Machine('M1','Machine1', processingTime={'distributionType':'Normal','mean':0.25,'stdev':0.1,'min':0.1,'max':1})
M2=Machine('M2','Machine2', processingTime={'distributionType':'Normal','mean':1.5,'stdev':0.3,'min':0.5,'max':5})
Q=Queue('Q1','Queue')
M2=Machine('M2','Machine2', distribution='Normal', mean=1.5, stdev=0.3, min=0.5, max=5)
E=Exit('E1','Exit')
#create failures
F1=Failure(victim=M1, distributionType='Fixed', MTTF=60, MTTR=5, repairman=R)
F2=Failure(victim=M2, distributionType='Fixed', MTTF=40, MTTR=10, repairman=R)
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment