Commit fc56bf36 authored by Georgios Dagkakis's avatar Georgios Dagkakis

Examples made much cleaner. SimPy is not visible and run simulation is done by one method call

parent 95b020d7
from dream.simulation.imports import Machine, Source, Exit, Part, Frame, Assembly, Failure, G from dream.simulation.imports import Machine, Source, Exit, Part, Frame, Assembly, Failure
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
Frame.capacity=4 Frame.capacity=4
...@@ -14,10 +11,6 @@ E=Exit('E1','Exit') ...@@ -14,10 +11,6 @@ E=Exit('E1','Exit')
F=Failure(victim=M, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5}) F=Failure(victim=M, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5})
#add objects in lists so that they can be easier accessed later
G.ObjList=[Sp,Sf,M,A,E]
G.ObjectInterruptionList=[F]
#define predecessors and successors for the objects #define predecessors and successors for the objects
Sp.defineRouting([A]) Sp.defineRouting([A])
Sf.defineRouting([A]) Sf.defineRouting([A])
...@@ -26,26 +19,16 @@ M.defineRouting([A],[E]) ...@@ -26,26 +19,16 @@ M.defineRouting([A],[E])
E.defineRouting([M]) E.defineRouting([M])
def main(): def main():
# add all the objects in a list
#initialize all the objects objectList=[Sp,Sf,M,A,E,F]
for object in G.ObjList + G.ObjectInterruptionList: # set the length of the experiment
object.initialize() maxSimTime=1440.0
# call the runSimulation giving the objects and the length of the experiment
#activate all the objects runSimulation(objectList, maxSimTime)
for object in G.ObjList + G.ObjectInterruptionList:
G.env.process(object.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
G.env.run(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 results
print "the system produced", E.numOfExits, "frames" print "the system produced", E.numOfExits, "frames"
working_ratio=(A.totalWorkingTime/G.maxSimTime)*100 working_ratio=(A.totalWorkingTime/maxSimTime)*100
print "the working ratio of", A.objName, "is", working_ratio, "%" print "the working ratio of", A.objName, "is", working_ratio, "%"
return {"frames": E.numOfExits, return {"frames": E.numOfExits,
"working_ratio": working_ratio} "working_ratio": working_ratio}
......
from dream.simulation.imports import Machine, Source, Exit, Batch, BatchDecomposition,\ from dream.simulation.imports import Machine, Source, Exit, Batch, BatchDecomposition,\
BatchSource, BatchReassembly, Queue, LineClearance, ExcelHandler, G, ExcelHandler BatchSource, BatchReassembly, Queue, LineClearance, ExcelHandler, ExcelHandler
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
# choose to output trace or not
G.trace='Yes'
# define the objects of the model # define the objects of the model
S=BatchSource('S','Source',interarrivalTime={'distributionType':'Fixed','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) Q=Queue('Q','StartQueue',capacity=100000)
...@@ -17,8 +12,7 @@ M2=Machine('M2','Machine2',processingTime={'distributionType':'Fixed','mean':4}) ...@@ -17,8 +12,7 @@ M2=Machine('M2','Machine2',processingTime={'distributionType':'Fixed','mean':4})
BRA=BatchReassembly('BRA', 'BatchReassembly', numberOfSubBatches=4, processingTime={'distributionType':'Fixed','mean':0}) BRA=BatchReassembly('BRA', 'BatchReassembly', numberOfSubBatches=4, processingTime={'distributionType':'Fixed','mean':0})
M3=Machine('M3','Machine3',processingTime={'distributionType':'Fixed','mean':1}) M3=Machine('M3','Machine3',processingTime={'distributionType':'Fixed','mean':1})
E=Exit('E','Exit') 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]
# define the predecessors and successors for the objects # define the predecessors and successors for the objects
S.defineRouting([Q]) S.defineRouting([Q])
Q.defineRouting([S],[BD]) Q.defineRouting([S],[BD])
...@@ -32,41 +26,34 @@ E.defineRouting([M3]) ...@@ -32,41 +26,34 @@ E.defineRouting([M3])
def main(): def main():
# initialize all the objects # add all the objects in a list
for object in G.ObjList: objectList=[S,Q,BD,M1,Q1,M2,BRA,M3,E]
object.initialize() # set the length of the experiment
maxSimTime=1440.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList: runSimulation(objectList, maxSimTime, trace='Yes')
G.env.process(object.run())
# set G.maxSimTime 1440.0 minutes (1 day)
G.maxSimTime=1440.0
# run the simulation
G.env.run(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 results
print "the system produced", E.numOfExits, "batches" print "the system produced", E.numOfExits, "batches"
working_ratio_M1 = (M1.totalWorkingTime/G.maxSimTime)*100 working_ratio_M1 = (M1.totalWorkingTime/maxSimTime)*100
blockage_ratio_M1 = (M1.totalBlockageTime/G.maxSimTime)*100 blockage_ratio_M1 = (M1.totalBlockageTime/maxSimTime)*100
waiting_ratio_M1 = (M1.totalWaitingTime/G.maxSimTime)*100 waiting_ratio_M1 = (M1.totalWaitingTime/maxSimTime)*100
print "the working ratio of", M1.objName, "is", working_ratio_M1 print "the working ratio of", M1.objName, "is", working_ratio_M1
print "the blockage ratio of", M1.objName, 'is', blockage_ratio_M1 print "the blockage ratio of", M1.objName, 'is', blockage_ratio_M1
print "the waiting ratio of", M1.objName, 'is', waiting_ratio_M1 print "the waiting ratio of", M1.objName, 'is', waiting_ratio_M1
working_ratio_M2 = (M2.totalWorkingTime/G.maxSimTime)*100 working_ratio_M2 = (M2.totalWorkingTime/maxSimTime)*100
blockage_ratio_M2 = (M2.totalBlockageTime/G.maxSimTime)*100 blockage_ratio_M2 = (M2.totalBlockageTime/maxSimTime)*100
waiting_ratio_M2 = (M2.totalWaitingTime/G.maxSimTime)*100 waiting_ratio_M2 = (M2.totalWaitingTime/maxSimTime)*100
print "the working ratio of", M2.objName, "is", working_ratio_M2 print "the working ratio of", M2.objName, "is", working_ratio_M2
print "the blockage ratio of", M2.objName, 'is', blockage_ratio_M2 print "the blockage ratio of", M2.objName, 'is', blockage_ratio_M2
print "the waiting ratio of", M2.objName, 'is', waiting_ratio_M2 print "the waiting ratio of", M2.objName, 'is', waiting_ratio_M2
working_ratio_M3 = (M3.totalWorkingTime/G.maxSimTime)*100 working_ratio_M3 = (M3.totalWorkingTime/maxSimTime)*100
blockage_ratio_M3 = (M3.totalBlockageTime/G.maxSimTime)*100 blockage_ratio_M3 = (M3.totalBlockageTime/maxSimTime)*100
waiting_ratio_M3 = (M3.totalWaitingTime/G.maxSimTime)*100 waiting_ratio_M3 = (M3.totalWaitingTime/maxSimTime)*100
print "the working ratio of", M3.objName, "is", working_ratio_M3 print "the working ratio of", M3.objName, "is", working_ratio_M3
print "the blockage ratio of", M3.objName, 'is', blockage_ratio_M3 print "the blockage ratio of", M3.objName, 'is', blockage_ratio_M3
print "the waiting ratio of", M3.objName, 'is', waiting_ratio_M3 print "the waiting ratio of", M3.objName, 'is', waiting_ratio_M3
ExcelHandler.outputTrace('TRACE')
return {"batches": E.numOfExits, return {"batches": E.numOfExits,
"working_ratio_M1": working_ratio_M1, "working_ratio_M1": working_ratio_M1,
......
from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDecomposition, Queue, G from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDecomposition, Queue
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
# define the objects of the model # define the objects of the model
S=BatchSource('S','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Batch', batchNumberOfUnits=4) S=BatchSource('S','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Batch', batchNumberOfUnits=4)
...@@ -10,8 +7,7 @@ Q=Queue('Q','StartQueue',capacity=100000) ...@@ -10,8 +7,7 @@ Q=Queue('Q','StartQueue',capacity=100000)
BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, processingTime={'distributionType':'Fixed','mean':1}) BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, processingTime={'distributionType':'Fixed','mean':1})
M=Machine('M','Machine',processingTime={'distributionType':'Fixed','mean':0.5}) M=Machine('M','Machine',processingTime={'distributionType':'Fixed','mean':0.5})
E=Exit('E','Exit') 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 # define the predecessors and successors for the objects
S.defineRouting([Q]) S.defineRouting([Q])
Q.defineRouting([S],[BD]) Q.defineRouting([S],[BD])
...@@ -21,27 +17,18 @@ E.defineRouting([M]) ...@@ -21,27 +17,18 @@ E.defineRouting([M])
def main(): def main():
# initialize all the objects # add all the objects in a list
for object in G.ObjList: objectList=[S,Q,BD,M,E]
object.initialize() # set the length of the experiment
maxSimTime=1440.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
# set G.maxSimTime 1440.0 minutes (1 day)
G.maxSimTime=1440.0
# run the simulation
G.env.run(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 results
print "the system produced", E.numOfExits, "subbatches" print "the system produced", E.numOfExits, "subbatches"
working_ratio = (M.totalWorkingTime/G.maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
blockage_ratio = (M.totalBlockageTime/G.maxSimTime)*100 blockage_ratio = (M.totalBlockageTime/maxSimTime)*100
waiting_ratio = (M.totalWaitingTime/G.maxSimTime)*100 waiting_ratio = (M.totalWaitingTime/maxSimTime)*100
print "the working ratio of", M.objName, "is", working_ratio print "the working ratio of", M.objName, "is", working_ratio
print "the blockage ratio of", M.objName, 'is', blockage_ratio print "the blockage ratio of", M.objName, 'is', blockage_ratio
print "the waiting ratio of", M.objName, 'is', waiting_ratio print "the waiting ratio of", M.objName, 'is', waiting_ratio
......
from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Job
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=float("inf")) Q1=QueueJobShop('Q1','Queue1', capacity=float("inf"))
...@@ -13,10 +10,8 @@ M2=MachineJobShop('M2','Machine2') ...@@ -13,10 +10,8 @@ M2=MachineJobShop('M2','Machine2')
M3=MachineJobShop('M3','Machine3') M3=MachineJobShop('M3','Machine3')
E=ExitJobShop('E','Exit') E=ExitJobShop('E','Exit')
G.ObjList=[M1,M2,M3,Q1,Q2,Q3,E] #add all the objects in G.ObjList so that they can be easier accessed later
#define the route of the Job in the system #define the route of the Job in the system
J1Route=[{"stationIdsList": ["Q1"]}, route=[{"stationIdsList": ["Q1"]},
{"stationIdsList": ["M1"],"processingTime":{"distributionType": "Fixed","mean": "1"}}, {"stationIdsList": ["M1"],"processingTime":{"distributionType": "Fixed","mean": "1"}},
{"stationIdsList": ["Q3"]}, {"stationIdsList": ["Q3"]},
{"stationIdsList": ["M3"],"processingTime":{"distributionType": "Fixed","mean": "3"}}, {"stationIdsList": ["M3"],"processingTime":{"distributionType": "Fixed","mean": "3"}},
...@@ -24,28 +19,15 @@ J1Route=[{"stationIdsList": ["Q1"]}, ...@@ -24,28 +19,15 @@ J1Route=[{"stationIdsList": ["Q1"]},
{"stationIdsList": ["M2"],"processingTime":{"distributionType": "Fixed","mean": "2"}}, {"stationIdsList": ["M2"],"processingTime":{"distributionType": "Fixed","mean": "2"}},
{"stationIdsList": ["E"],}] {"stationIdsList": ["E"],}]
#define the Jobs #define the Jobs
J=Job('J1','Job1',route=J1Route) J=Job('J1','Job1',route=route)
G.EntityList=[J] #a list to hold all the entities
def main(): def main():
#initialize all the objects # add all the objects in a list
for object in G.ObjList + G.EntityList: objectList=[M1,M2,M3,Q1,Q2,Q3,E,J]
object.initialize() # set the length of the experiment
maxSimTime=float('inf')
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
#set the WIP
Globals.setWIP(G.EntityList)
G.env.run(until=float("inf")) #run the simulation until there are no more events
G.maxSimTime=E.timeLastEntityLeft #calculate the maxSimTime as the time that the last Job left
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#loop in the schedule to print the results #loop in the schedule to print the results
returnSchedule=[] # dummy variable used just for returning values and testing returnSchedule=[] # dummy variable used just for returning values and testing
......
from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G, ExcelHandler from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Job, ExcelHandler
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
G.trace="Yes"
#define the objects of the model #define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=float("inf")) Q1=QueueJobShop('Q1','Queue1', capacity=float("inf"))
...@@ -15,10 +10,8 @@ M2=MachineJobShop('M2','Machine2') ...@@ -15,10 +10,8 @@ M2=MachineJobShop('M2','Machine2')
M3=MachineJobShop('M3','Machine3') M3=MachineJobShop('M3','Machine3')
E=ExitJobShop('E','Exit') E=ExitJobShop('E','Exit')
G.ObjList=[M1,M2,M3,Q1,Q2,Q3,E] #add all the objects in G.ObjList so that they can be easier accessed later
#define the route of the Job in the system #define the route of the Job in the system
J1Route=[{"stationIdsList": ["Q1"]}, route=[{"stationIdsList": ["Q1"]},
{"stationIdsList": ["M1"],"processingTime":{"distributionType": "Fixed","mean": "1"}}, {"stationIdsList": ["M1"],"processingTime":{"distributionType": "Fixed","mean": "1"}},
{"stationIdsList": ["Q3"]}, {"stationIdsList": ["Q3"]},
{"stationIdsList": ["M3"],"processingTime":{"distributionType": "Fixed","mean": "3"}}, {"stationIdsList": ["M3"],"processingTime":{"distributionType": "Fixed","mean": "3"}},
...@@ -26,28 +19,15 @@ J1Route=[{"stationIdsList": ["Q1"]}, ...@@ -26,28 +19,15 @@ J1Route=[{"stationIdsList": ["Q1"]},
{"stationIdsList": ["M2"],"processingTime":{"distributionType": "Fixed","mean": "2"}}, {"stationIdsList": ["M2"],"processingTime":{"distributionType": "Fixed","mean": "2"}},
{"stationIdsList": ["E"],}] {"stationIdsList": ["E"],}]
#define the Jobs #define the Jobs
J=Job('J1','Job1',route=J1Route) J=Job('J1','Job1',route=route)
G.EntityList=[J] #a list to hold all the jobs
def main(): def main():
#initialize all the objects # add all the objects in a list
for object in G.ObjList + G.EntityList: objectList=[M1,M2,M3,Q1,Q2,Q3,E,J]
object.initialize() # set the length of the experiment
maxSimTime=float('inf')
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList: runSimulation(objectList, maxSimTime, trace='Yes')
G.env.process(object.run())
#set the WIP
Globals.setWIP(G.EntityList)
G.env.run(until=float("inf")) #run the simulation until there are no more events
G.maxSimTime=E.timeLastEntityLeft #calculate the maxSimTime as the time that the last Job left
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#loop in the schedule to print the results #loop in the schedule to print the results
schedule=[] schedule=[]
......
from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Job
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=float("inf"), schedulingRule="EDD") Q1=QueueJobShop('Q1','Queue1', capacity=float("inf"), schedulingRule="EDD")
...@@ -13,8 +10,6 @@ M2=MachineJobShop('M2','Machine2') ...@@ -13,8 +10,6 @@ M2=MachineJobShop('M2','Machine2')
M3=MachineJobShop('M3','Machine3') M3=MachineJobShop('M3','Machine3')
E=ExitJobShop('E','Exit') E=ExitJobShop('E','Exit')
G.ObjList=[M1,M2,M3,Q1,Q2,Q3,E] #add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects #define predecessors and successors for the objects
Q1.defineRouting(successorList=[M1]) Q1.defineRouting(successorList=[M1])
Q2.defineRouting(successorList=[M2]) Q2.defineRouting(successorList=[M2])
...@@ -48,32 +43,18 @@ J3Route=[{"stationIdsList": ["Q1"]}, ...@@ -48,32 +43,18 @@ J3Route=[{"stationIdsList": ["Q1"]},
J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100) J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100)
J2=Job('J2','Job2',route=J2Route, priority=1, dueDate=90) J2=Job('J2','Job2',route=J2Route, priority=1, dueDate=90)
J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110) J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110)
G.EntityList=[J1,J2,J3] #a list to hold all the entities
def main(): def main():
# add all the objects in a list
#initialize all the objects objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3]
for object in G.ObjList + G.EntityList: # set the length of the experiment
object.initialize() maxSimTime=float('inf')
# call the runSimulation giving the objects and the length of the experiment
#set the WIP runSimulation(objectList, maxSimTime)
Globals.setWIP(G.EntityList)
#activate all the objects
for object in G.ObjList:
G.env.process(object.run())
G.env.run(until=float("inf")) #run the simulation until there are no more events
G.maxSimTime=E.timeLastEntityLeft #calculate the maxSimTime as the time that the last Job left
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#output the schedule of every job #output the schedule of every job
returnSchedule=[] # dummy variable used just for returning values and testing returnSchedule=[] # dummy variable used just for returning values and testing
for job in G.EntityList: for job in [J1,J2,J3]:
#loop in the schedule to print the results #loop in the schedule to print the results
for record in job.schedule: for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id #schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
......
from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Job
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=float("inf"), schedulingRule="MC-Priority-EDD") Q1=QueueJobShop('Q1','Queue1', capacity=float("inf"), schedulingRule="MC-Priority-EDD")
...@@ -13,8 +10,6 @@ M2=MachineJobShop('M2','Machine2') ...@@ -13,8 +10,6 @@ M2=MachineJobShop('M2','Machine2')
M3=MachineJobShop('M3','Machine3') M3=MachineJobShop('M3','Machine3')
E=ExitJobShop('E','Exit') E=ExitJobShop('E','Exit')
G.ObjList=[M1,M2,M3,Q1,Q2,Q3,E] #add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects #define predecessors and successors for the objects
Q1.defineRouting(successorList=[M1]) Q1.defineRouting(successorList=[M1])
Q2.defineRouting(successorList=[M2]) Q2.defineRouting(successorList=[M2])
...@@ -48,32 +43,18 @@ J3Route=[{"stationIdsList": ["Q1"]}, ...@@ -48,32 +43,18 @@ J3Route=[{"stationIdsList": ["Q1"]},
J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100) J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100)
J2=Job('J2','Job2',route=J2Route, priority=1, dueDate=90) J2=Job('J2','Job2',route=J2Route, priority=1, dueDate=90)
J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110) J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110)
G.EntityList=[J1,J2,J3] #a list to hold all the jobs
def main(): def main():
# add all the objects in a list
#initialize all the objects objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3]
for object in G.ObjList + G.EntityList: # set the length of the experiment
object.initialize() maxSimTime=float('inf')
# call the runSimulation giving the objects and the length of the experiment
#set the WIP runSimulation(objectList, maxSimTime)
Globals.setWIP(G.EntityList)
#activate all the objects
for object in G.ObjList:
G.env.process(object.run())
G.env.run(until=float("inf")) #run the simulation until there are no more events
G.maxSimTime=E.timeLastEntityLeft #calculate the maxSimTime as the time that the last Job left
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#output the schedule of every job #output the schedule of every job
returnSchedule=[] # dummy variable used just for returning values and testing returnSchedule=[] # dummy variable used just for returning values and testing
for job in G.EntityList: for job in [J1,J2,J3]:
#loop in the schedule to print the results #loop in the schedule to print the results
for record in job.schedule: for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id #schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
......
from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Job
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=float("inf"), schedulingRule="Priority") Q1=QueueJobShop('Q1','Queue1', capacity=float("inf"), schedulingRule="Priority")
...@@ -13,8 +10,6 @@ M2=MachineJobShop('M2','Machine2') ...@@ -13,8 +10,6 @@ M2=MachineJobShop('M2','Machine2')
M3=MachineJobShop('M3','Machine3') M3=MachineJobShop('M3','Machine3')
E=ExitJobShop('E','Exit') E=ExitJobShop('E','Exit')
G.ObjList=[M1,M2,M3,Q1,Q2,Q3,E] #add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects #define predecessors and successors for the objects
Q1.defineRouting(successorList=[M1]) Q1.defineRouting(successorList=[M1])
Q2.defineRouting(successorList=[M2]) Q2.defineRouting(successorList=[M2])
...@@ -48,32 +43,18 @@ J3Route=[{"stationIdsList": ["Q1"]}, ...@@ -48,32 +43,18 @@ J3Route=[{"stationIdsList": ["Q1"]},
J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100) J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100)
J2=Job('J2','Job2',route=J2Route, priority=1, dueDate=90) J2=Job('J2','Job2',route=J2Route, priority=1, dueDate=90)
J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110) J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110)
G.EntityList=[J1,J2,J3] #a list to hold all the jobs
def main(): def main():
# add all the objects in a list
#initialize all the objects objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3]
for object in G.ObjList + G.EntityList: # set the length of the experiment
object.initialize() maxSimTime=float('inf')
# call the runSimulation giving the objects and the length of the experiment
#set the WIP runSimulation(objectList, maxSimTime)
Globals.setWIP(G.EntityList)
#activate all the objects
for object in G.ObjList:
G.env.process(object.run())
G.env.run(until=float("inf")) #run the simulation until there are no more events
G.maxSimTime=E.timeLastEntityLeft #calculate the maxSimTime as the time that the last Job left
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#output the schedule of every job #output the schedule of every job
returnSchedule=[] # dummy variable used just for returning values and testing returnSchedule=[] # dummy variable used just for returning values and testing
for job in G.EntityList: for job in [J1,J2,J3]:
#loop in the schedule to print the results #loop in the schedule to print the results
for record in job.schedule: for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id #schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
......
from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Globals, Job, G from dream.simulation.imports import MachineJobShop, QueueJobShop, ExitJobShop, Job
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=float("inf"), schedulingRule="RPC") Q1=QueueJobShop('Q1','Queue1', capacity=float("inf"), schedulingRule="RPC")
...@@ -13,8 +10,6 @@ M2=MachineJobShop('M2','Machine2') ...@@ -13,8 +10,6 @@ M2=MachineJobShop('M2','Machine2')
M3=MachineJobShop('M3','Machine3') M3=MachineJobShop('M3','Machine3')
E=ExitJobShop('E','Exit') E=ExitJobShop('E','Exit')
G.ObjList=[M1,M2,M3,Q1,Q2,Q3,E] #add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects #define predecessors and successors for the objects
Q1.defineRouting(successorList=[M1]) Q1.defineRouting(successorList=[M1])
Q2.defineRouting(successorList=[M2]) Q2.defineRouting(successorList=[M2])
...@@ -48,32 +43,18 @@ J3Route=[{"stationIdsList": ["Q1"]}, ...@@ -48,32 +43,18 @@ J3Route=[{"stationIdsList": ["Q1"]},
J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100) J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100)
J2=Job('J2','Job2',route=J2Route, priority=1, dueDate=90) J2=Job('J2','Job2',route=J2Route, priority=1, dueDate=90)
J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110) J3=Job('J3','Job3',route=J3Route, priority=0, dueDate=110)
G.EntityList=[J1,J2,J3] #a list to hold all the jobs
def main(): def main():
# add all the objects in a list
#initialize all the objects objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3]
for object in G.ObjList + G.EntityList: # set the length of the experiment
object.initialize() maxSimTime=float('inf')
# call the runSimulation giving the objects and the length of the experiment
#set the WIP runSimulation(objectList, maxSimTime)
Globals.setWIP(G.EntityList)
#activate all the objects
for object in G.ObjList:
G.env.process(object.run())
G.env.run(until=float("inf")) #run the simulation until there are no more events
G.maxSimTime=E.timeLastEntityLeft #calculate the maxSimTime as the time that the last Job left
#carry on the post processing operations for every object in the topology
for object in G.ObjList:
object.postProcessing()
#output the schedule of every job #output the schedule of every job
returnSchedule=[] # dummy variable used just for returning values and testing returnSchedule=[] # dummy variable used just for returning values and testing
for job in G.EntityList: for job in [J1,J2,J3]:
#loop in the schedule to print the results #loop in the schedule to print the results
for record in job.schedule: for record in job.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id #schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
......
from dream.simulation.imports import Machine, Source, Exit, Part, Queue, G, Failure from dream.simulation.imports import Machine, Source, Exit, Part, Queue, Failure
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
S=Source('S','Source', interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part') S=Source('S','Source', interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
Q=Queue('Q','Queue', capacity=float("inf")) Q=Queue('Q','Queue', capacity=float("inf"))
M1=Machine('M1','Milling1', processingTime={'distributionType':'Fixed','mean':0.25}) M1=Machine('M1','Milling1', processingTime={'distributionType':'Fixed','mean':0.25})
M2=Machine('M2','Milling2', processingTime={'distributionType':'Fixed','mean':0.25}) M2=Machine('M2','Milling2', processingTime={'distributionType':'Fixed','mean':0.25})
E=Exit('E1','Exit') E=Exit('E1','Exit')
F=Failure(victim=M1, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5}) F=Failure(victim=M1, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5})
#add objects in lists so that they can be easier accessed later
G.ObjList=[S,Q,M1,M2,E]
G.ObjectInterruptionList=[F]
#define predecessors and successors for the objects #define predecessors and successors for the objects
S.defineRouting([Q]) S.defineRouting([Q])
Q.defineRouting([S],[M1,M2]) Q.defineRouting([S],[M1,M2])
...@@ -25,26 +18,17 @@ E.defineRouting([M1,M2]) ...@@ -25,26 +18,17 @@ E.defineRouting([M1,M2])
def main(): def main():
#initialize all the objects # add all the objects in a list
for object in G.ObjList + G.ObjectInterruptionList: objectList=[S,Q,M1,M2,E,F]
object.initialize() # set the length of the experiment
maxSimTime=1440.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList + G.ObjectInterruptionList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
G.env.run(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 results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
working_ratio_M1=(M1.totalWorkingTime/G.maxSimTime)*100 working_ratio_M1=(M1.totalWorkingTime/maxSimTime)*100
working_ratio_M2=(M2.totalWorkingTime/G.maxSimTime)*100 working_ratio_M2=(M2.totalWorkingTime/maxSimTime)*100
print "the working ratio of", M1.objName, "is", working_ratio_M1, "%" print "the working ratio of", M1.objName, "is", working_ratio_M1, "%"
print "the working ratio of", M2.objName, "is", working_ratio_M2, "%" print "the working ratio of", M2.objName, "is", working_ratio_M2, "%"
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
......
from dream.simulation.imports import Machine, Source, Exit, Part, Queue, G, Globals, Failure from dream.simulation.imports import Machine, Source, Exit, Part, Queue, Failure
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#the custom queue #the custom queue
class SelectiveQueue(Queue): class SelectiveQueue(Queue):
...@@ -20,13 +17,8 @@ Q=SelectiveQueue('Q','Queue', capacity=float("inf")) ...@@ -20,13 +17,8 @@ Q=SelectiveQueue('Q','Queue', capacity=float("inf"))
M1=Machine('M1','Milling1', processingTime={'distributionType':'Fixed','mean':0.25}) M1=Machine('M1','Milling1', processingTime={'distributionType':'Fixed','mean':0.25})
M2=Machine('M2','Milling2', processingTime={'distributionType':'Fixed','mean':0.25}) M2=Machine('M2','Milling2', processingTime={'distributionType':'Fixed','mean':0.25})
E=Exit('E1','Exit') E=Exit('E1','Exit')
F=Failure(victim=M1, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5}) F=Failure(victim=M1, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5})
#add objects in lists so that they can be easier accessed later
G.ObjList=[S,Q,M1,M2,E]
G.ObjectInterruptionList=[F]
#define predecessors and successors for the objects #define predecessors and successors for the objects
S.defineRouting([Q]) S.defineRouting([Q])
Q.defineRouting([S],[M1,M2]) Q.defineRouting([S],[M1,M2])
...@@ -36,26 +28,17 @@ E.defineRouting([M1,M2]) ...@@ -36,26 +28,17 @@ E.defineRouting([M1,M2])
def main(): def main():
#initialize all the objects # add all the objects in a list
for object in G.ObjList + G.ObjectInterruptionList: objectList=[S,Q,M1,M2,E,F]
object.initialize() # set the length of the experiment
maxSimTime=1440.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList + G.ObjectInterruptionList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
G.env.run(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 results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
working_ratio_M1=(M1.totalWorkingTime/G.maxSimTime)*100 working_ratio_M1=(M1.totalWorkingTime/maxSimTime)*100
working_ratio_M2=(M2.totalWorkingTime/G.maxSimTime)*100 working_ratio_M2=(M2.totalWorkingTime/maxSimTime)*100
print "the working ratio of", M1.objName, "is", working_ratio_M1, "%" print "the working ratio of", M1.objName, "is", working_ratio_M1, "%"
print "the working ratio of", M2.objName, "is", working_ratio_M2, "%" print "the working ratio of", M2.objName, "is", working_ratio_M2, "%"
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
......
from dream.simulation.imports import Machine, Source, Exit, Part, Queue, G, Globals, Failure from dream.simulation.imports import Machine, Source, Exit, Part, Queue, Globals, Failure, G
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#the custom queue #the custom queue
class SelectiveQueue(Queue): class SelectiveQueue(Queue):
...@@ -40,13 +36,8 @@ Q=SelectiveQueue('Q','Queue', capacity=float("inf")) ...@@ -40,13 +36,8 @@ Q=SelectiveQueue('Q','Queue', capacity=float("inf"))
M1=Milling('M1','Milling1', processingTime={'distributionType':'Fixed','mean':0.25}) M1=Milling('M1','Milling1', processingTime={'distributionType':'Fixed','mean':0.25})
M2=Milling('M2','Milling2', processingTime={'distributionType':'Fixed','mean':0.25}) M2=Milling('M2','Milling2', processingTime={'distributionType':'Fixed','mean':0.25})
E=CountingExit('E1','Exit') E=CountingExit('E1','Exit')
F=Failure(victim=M1, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5}) F=Failure(victim=M1, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5})
#add objects in lists so that they can be easier accessed later
G.ObjList=[S,Q,M1,M2,E]
G.ObjectInterruptionList=[F]
#create the global counter variables #create the global counter variables
G.NumM1=0 G.NumM1=0
G.NumM2=0 G.NumM2=0
...@@ -60,26 +51,17 @@ E.defineRouting([M1,M2]) ...@@ -60,26 +51,17 @@ E.defineRouting([M1,M2])
def main(): def main():
#initialize all the objects # add all the objects in a list
for object in G.ObjList + G.ObjectInterruptionList: objectList=[S,Q,M1,M2,E,F]
object.initialize() # set the length of the experiment
maxSimTime=1440.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList + G.ObjectInterruptionList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
G.env.run(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 results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
working_ratio_M1=(M1.totalWorkingTime/G.maxSimTime)*100 working_ratio_M1=(M1.totalWorkingTime/maxSimTime)*100
working_ratio_M2=(M2.totalWorkingTime/G.maxSimTime)*100 working_ratio_M2=(M2.totalWorkingTime/maxSimTime)*100
print "the working ratio of", M1.objName, "is", working_ratio_M1, "%" print "the working ratio of", M1.objName, "is", working_ratio_M1, "%"
print "the working ratio of", M2.objName, "is", working_ratio_M2, "%" print "the working ratio of", M2.objName, "is", working_ratio_M2, "%"
print M1.objName, "produced", G.NumM1, "parts" print M1.objName, "produced", G.NumM1, "parts"
......
from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDecomposition, BatchReassembly, Queue, G from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDecomposition, BatchReassembly, Queue
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
# define the objects of the model # define the objects of the model
S=BatchSource('S','Source',interarrivalTime={'distributionType':'Fixed','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) Q=Queue('Q','StartQueue',capacity=100000)
...@@ -13,8 +11,7 @@ M2=Machine('M2','Machine2',processingTime={'distributionType':'Fixed','mean':1}) ...@@ -13,8 +11,7 @@ M2=Machine('M2','Machine2',processingTime={'distributionType':'Fixed','mean':1})
BRA=BatchReassembly('BRA', 'BatchReassembly', numberOfSubBatches=4, processingTime={'distributionType':'Fixed','mean':0}) BRA=BatchReassembly('BRA', 'BatchReassembly', numberOfSubBatches=4, processingTime={'distributionType':'Fixed','mean':0})
M3=Machine('M3','Machine3',processingTime={'distributionType':'Fixed','mean':1}) M3=Machine('M3','Machine3',processingTime={'distributionType':'Fixed','mean':1})
E=Exit('E','Exit') 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]
# define the predecessors and successors for the objects # define the predecessors and successors for the objects
S.defineRouting([Q]) S.defineRouting([Q])
Q.defineRouting([S],[BD]) Q.defineRouting([S],[BD])
...@@ -27,38 +24,30 @@ M3.defineRouting([BRA],[E]) ...@@ -27,38 +24,30 @@ M3.defineRouting([BRA],[E])
E.defineRouting([M3]) E.defineRouting([M3])
def main(): def main():
# initialize all the objects # add all the objects in a list
for object in G.ObjList: objectList=[S,Q,BD,M1,Q1,M2,BRA,M3,E]
object.initialize() # set the length of the experiment
maxSimTime=1440.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
# set G.maxSimTime 1440.0 minutes (1 day)
G.maxSimTime=1440.0
# run the simulation
G.env.run(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 results
print "the system produced", E.numOfExits, "batches" print "the system produced", E.numOfExits, "batches"
working_ratio_M1 = (M1.totalWorkingTime/G.maxSimTime)*100 working_ratio_M1 = (M1.totalWorkingTime/maxSimTime)*100
blockage_ratio_M1 = (M1.totalBlockageTime/G.maxSimTime)*100 blockage_ratio_M1 = (M1.totalBlockageTime/maxSimTime)*100
waiting_ratio_M1 = (M1.totalWaitingTime/G.maxSimTime)*100 waiting_ratio_M1 = (M1.totalWaitingTime/maxSimTime)*100
print "the working ratio of", M1.objName, "is", working_ratio_M1 print "the working ratio of", M1.objName, "is", working_ratio_M1
print "the blockage ratio of", M1.objName, 'is', blockage_ratio_M1 print "the blockage ratio of", M1.objName, 'is', blockage_ratio_M1
print "the waiting ratio of", M1.objName, 'is', waiting_ratio_M1 print "the waiting ratio of", M1.objName, 'is', waiting_ratio_M1
working_ratio_M2 = (M2.totalWorkingTime/G.maxSimTime)*100 working_ratio_M2 = (M2.totalWorkingTime/maxSimTime)*100
blockage_ratio_M2 = (M2.totalBlockageTime/G.maxSimTime)*100 blockage_ratio_M2 = (M2.totalBlockageTime/maxSimTime)*100
waiting_ratio_M2 = (M2.totalWaitingTime/G.maxSimTime)*100 waiting_ratio_M2 = (M2.totalWaitingTime/maxSimTime)*100
print "the working ratio of", M2.objName, "is", working_ratio_M2 print "the working ratio of", M2.objName, "is", working_ratio_M2
print "the blockage ratio of", M2.objName, 'is', blockage_ratio_M2 print "the blockage ratio of", M2.objName, 'is', blockage_ratio_M2
print "the waiting ratio of", M2.objName, 'is', waiting_ratio_M2 print "the waiting ratio of", M2.objName, 'is', waiting_ratio_M2
working_ratio_M3 = (M3.totalWorkingTime/G.maxSimTime)*100 working_ratio_M3 = (M3.totalWorkingTime/maxSimTime)*100
blockage_ratio_M3 = (M3.totalBlockageTime/G.maxSimTime)*100 blockage_ratio_M3 = (M3.totalBlockageTime/maxSimTime)*100
waiting_ratio_M3 = (M3.totalWaitingTime/G.maxSimTime)*100 waiting_ratio_M3 = (M3.totalWaitingTime/maxSimTime)*100
print "the working ratio of", M3.objName, "is", working_ratio_M3 print "the working ratio of", M3.objName, "is", working_ratio_M3
print "the blockage ratio of", M3.objName, 'is', blockage_ratio_M3 print "the blockage ratio of", M3.objName, 'is', blockage_ratio_M3
print "the waiting ratio of", M3.objName, 'is', waiting_ratio_M3 print "the waiting ratio of", M3.objName, 'is', waiting_ratio_M3
......
from dream.simulation.imports import Machine, Source, Exit, Part, G, ShiftScheduler from dream.simulation.imports import Machine, Source, Exit, Part, ShiftScheduler
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part') S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':3}) M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':3})
E=Exit('E1','Exit') E=Exit('E1','Exit')
G.ObjList=[S,M,E] #add all the objects in a list so that they can be easier accessed later
#create the shift
SS=ShiftScheduler(victim=M, shiftPattern=[[0,5],[10,15]]) SS=ShiftScheduler(victim=M, shiftPattern=[[0,5],[10,15]])
G.ObjectInterruptionList=[SS] #add all the interruptions in a list so that they can be easier accessed later
#define predecessors and successors for the objects #define predecessors and successors for the objects
S.defineRouting(successorList=[M]) S.defineRouting(successorList=[M])
...@@ -22,26 +15,17 @@ E.defineRouting(predecessorList=[M]) ...@@ -22,26 +15,17 @@ E.defineRouting(predecessorList=[M])
def main(): def main():
#initialize all the objects # add all the objects in a list
for object in G.ObjList + G.ObjectInterruptionList: objectList=[S,M,E,SS]
object.initialize() # set the length of the experiment
maxSimTime=20.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList + G.ObjectInterruptionList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
G.maxSimTime=20 #set G.maxSimTime 1440.0 minutes (1 day)
G.env.run(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 results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/G.maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
off_shift_ratio=(M.totalOffShiftTime/G.maxSimTime)*100 off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%" print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%" print "the total off-shift ratio of the Machine is", off_shift_ratio, "%"
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
......
from dream.simulation.imports import Machine, Source, Exit, Part, G, ShiftScheduler from dream.simulation.imports import Machine, Source, Exit, Part, ShiftScheduler
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part') S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':3}) M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':3})
E=Exit('E1','Exit') E=Exit('E1','Exit')
G.ObjList=[S,M,E] #add all the objects in a list so that they can be easier accessed later
# create a repeated shift pattern # create a repeated shift pattern
shiftPattern=[] shiftPattern=[]
i = 0 i = 0
...@@ -21,7 +16,6 @@ print shiftPattern ...@@ -21,7 +16,6 @@ print shiftPattern
#create the shift #create the shift
SS=ShiftScheduler(victim=M, shiftPattern=shiftPattern) SS=ShiftScheduler(victim=M, shiftPattern=shiftPattern)
G.ObjectInterruptionList=[SS] #add all the interruptions in a list so that they can be easier accessed later
#define predecessors and successors for the objects #define predecessors and successors for the objects
S.defineRouting(successorList=[M]) S.defineRouting(successorList=[M])
...@@ -30,26 +24,17 @@ E.defineRouting(predecessorList=[M]) ...@@ -30,26 +24,17 @@ E.defineRouting(predecessorList=[M])
def main(): def main():
#initialize all the objects # add all the objects in a list
for object in G.ObjList + G.ObjectInterruptionList: objectList=[S,M,E,SS]
object.initialize() # set the length of the experiment
maxSimTime=100.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList + G.ObjectInterruptionList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
G.maxSimTime=100 #set G.maxSimTime 1440.0 minutes (1 day)
G.env.run(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 results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/G.maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
off_shift_ratio=(M.totalOffShiftTime/G.maxSimTime)*100 off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%" print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%" print "the total off-shift ratio of the Machine is", off_shift_ratio, "%"
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
......
from dream.simulation.imports import Machine, Source, Exit, Part, G, ShiftScheduler from dream.simulation.imports import Machine, Source, Exit, Part, ShiftScheduler
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part') S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':3}) M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':3})
E=Exit('E1','Exit') E=Exit('E1','Exit')
G.ObjList=[S,M,E] #add all the objects in a list so that they can be easier accessed later
#create the shift
SS=ShiftScheduler(victim=M, shiftPattern=[[0,5],[10,15]], endUnfinished=True) SS=ShiftScheduler(victim=M, shiftPattern=[[0,5],[10,15]], endUnfinished=True)
G.ObjectInterruptionList=[SS] #add all the interruptions in a list so that they can be easier accessed later
#define predecessors and successors for the objects #define predecessors and successors for the objects
S.defineRouting(successorList=[M]) S.defineRouting(successorList=[M])
...@@ -22,26 +15,17 @@ E.defineRouting(predecessorList=[M]) ...@@ -22,26 +15,17 @@ E.defineRouting(predecessorList=[M])
def main(): def main():
#initialize all the objects # add all the objects in a list
for object in G.ObjList + G.ObjectInterruptionList: objectList=[S,M,E,SS]
object.initialize() # set the length of the experiment
maxSimTime=20.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList + G.ObjectInterruptionList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
G.maxSimTime=20 #set G.maxSimTime 1440.0 minutes (1 day)
G.env.run(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 results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/G.maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
off_shift_ratio=(M.totalOffShiftTime/G.maxSimTime)*100 off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%" print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%" print "the total off-shift ratio of the Machine is", off_shift_ratio, "%"
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
......
from dream.simulation.imports import Machine, Source, Exit, Part, G, ShiftScheduler from dream.simulation.imports import Machine, Source, Exit, Part, ShiftScheduler
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part') S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':3}) M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':3})
E=Exit('E1','Exit') E=Exit('E1','Exit')
G.ObjList=[S,M,E] #add all the objects in a list so that they can be easier accessed later SS=ShiftScheduler(victim=M, shiftPattern=[[0,5],[10,15]],receiveBeforeEndThreshold=3)
#create the shift
SS=ShiftScheduler(victim=M, shiftPattern=[[0,5],[10,15]], receiveBeforeEndThreshold=3)
G.ObjectInterruptionList=[SS] #add all the interruptions in a list so that they can be easier accessed later
#define predecessors and successors for the objects #define predecessors and successors for the objects
S.defineRouting(successorList=[M]) S.defineRouting(successorList=[M])
...@@ -22,26 +15,17 @@ E.defineRouting(predecessorList=[M]) ...@@ -22,26 +15,17 @@ E.defineRouting(predecessorList=[M])
def main(): def main():
#initialize all the objects # add all the objects in a list
for object in G.ObjList + G.ObjectInterruptionList: objectList=[S,M,E,SS]
object.initialize() # set the length of the experiment
maxSimTime=20.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList + G.ObjectInterruptionList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
G.maxSimTime=20 #set G.maxSimTime 1440.0 minutes (1 day)
G.env.run(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 results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/G.maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
off_shift_ratio=(M.totalOffShiftTime/G.maxSimTime)*100 off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%" print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%" print "the total off-shift ratio of the Machine is", off_shift_ratio, "%"
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
......
from dream.simulation.imports import Machine, Source, Exit, Part, G from dream.simulation.imports import Machine, Source, Exit, Part
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part') S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':0.25}) M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':0.25})
E=Exit('E1','Exit') E=Exit('E1','Exit')
G.ObjList=[S,M,E] #add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects #define predecessors and successors for the objects
S.defineRouting(successorList=[M]) S.defineRouting(successorList=[M])
M.defineRouting(predecessorList=[S],successorList=[E]) M.defineRouting(predecessorList=[S],successorList=[E])
E.defineRouting(predecessorList=[M]) E.defineRouting(predecessorList=[M])
def main(): def main():
# add all the objects in a list
#initialize all the objects objectList=[S,M,E]
for object in G.ObjList: # set the length of the experiment
object.initialize() maxSimTime=1440.0
# call the runSimulation giving the objects and the length of the experiment
#activate all the objects runSimulation(objectList, maxSimTime)
for object in G.ObjList:
G.env.process(object.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
G.env.run(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 results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/G.maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%" print "the total working ratio of the Machine is", working_ratio, "%"
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"working_ratio": working_ratio} "working_ratio": working_ratio}
......
from dream.simulation.imports import Machine, Source, Exit, Part, G, Repairman, Queue, Failure from dream.simulation.imports import Machine, Source, Exit, Part, Repairman, Queue, Failure
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
R=Repairman('R1', 'Bob') R=Repairman('R1', 'Bob')
...@@ -11,16 +8,10 @@ M1=Machine('M1','Machine1', processingTime={'distributionType':'Fixed','mean':0. ...@@ -11,16 +8,10 @@ M1=Machine('M1','Machine1', processingTime={'distributionType':'Fixed','mean':0.
Q=Queue('Q1','Queue') Q=Queue('Q1','Queue')
M2=Machine('M2','Machine2', processingTime={'distributionType':'Fixed','mean':1.5}) M2=Machine('M2','Machine2', processingTime={'distributionType':'Fixed','mean':1.5})
E=Exit('E1','Exit') E=Exit('E1','Exit')
#create failures #create failures
F1=Failure(victim=M1, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5}, 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) F2=Failure(victim=M2, distribution={'distributionType':'Fixed','MTTF':40,'MTTR':10}, repairman=R)
#add objects in lists so that they can be easier accessed later
G.ObjList=[S,M1,M2,E,Q]
G.ObjectResourceList=[R]
G.ObjectInterruptionList=[F1,F2]
#define predecessors and successors for the objects #define predecessors and successors for the objects
S.defineRouting([M1]) S.defineRouting([M1])
M1.defineRouting([S],[Q]) M1.defineRouting([S],[Q])
...@@ -30,26 +21,17 @@ E.defineRouting([M2]) ...@@ -30,26 +21,17 @@ E.defineRouting([M2])
def main(): def main():
#initialize all the objects # add all the objects in a list
for object in G.ObjList + G.ObjectInterruptionList + G.ObjectResourceList: objectList=[S,M1,M2,E,Q,R,F1,F2]
object.initialize() # set the length of the experiment
maxSimTime=1440.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList + G.ObjectInterruptionList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
G.env.run(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList + G.ObjectResourceList:
object.postProcessing()
#print the results #print the results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
blockage_ratio = (M1.totalBlockageTime/G.maxSimTime)*100 blockage_ratio = (M1.totalBlockageTime/maxSimTime)*100
working_ratio = (R.totalWorkingTime/G.maxSimTime)*100 working_ratio = (R.totalWorkingTime/maxSimTime)*100
print "the blockage ratio of", M1.objName, "is", blockage_ratio, "%" print "the blockage ratio of", M1.objName, "is", blockage_ratio, "%"
print "the working ratio of", R.objName,"is", working_ratio, "%" print "the working ratio of", R.objName,"is", working_ratio, "%"
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
......
from dream.simulation.imports import Machine, Source, Exit, Part, G, Repairman, Queue, Failure from dream.simulation.imports import Machine, Source, Exit, Part, Repairman, Queue, Failure
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
#import Graphs
from dream.KnowledgeExtraction.Plots import Graphs
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model #define the objects of the model
R=Repairman('R1', 'Bob') R=Repairman('R1', 'Bob')
...@@ -14,16 +8,10 @@ M1=Machine('M1','Machine1', processingTime={'distributionType':'Fixed','mean':0. ...@@ -14,16 +8,10 @@ M1=Machine('M1','Machine1', processingTime={'distributionType':'Fixed','mean':0.
Q=Queue('Q1','Queue') Q=Queue('Q1','Queue')
M2=Machine('M2','Machine2', processingTime={'distributionType':'Fixed','mean':1.5}) M2=Machine('M2','Machine2', processingTime={'distributionType':'Fixed','mean':1.5})
E=Exit('E1','Exit') E=Exit('E1','Exit')
#create failures #create failures
F1=Failure(victim=M1, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5}, 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) F2=Failure(victim=M2, distribution={'distributionType':'Fixed','MTTF':40,'MTTR':10}, repairman=R)
#add objects in lists so that they can be easier accessed later
G.ObjList=[S,M1,M2,E,Q]
G.ObjectResourceList=[R]
G.ObjectInterruptionList=[F1,F2]
#define predecessors and successors for the objects #define predecessors and successors for the objects
S.defineRouting([M1]) S.defineRouting([M1])
M1.defineRouting([S],[Q]) M1.defineRouting([S],[Q])
...@@ -31,34 +19,26 @@ Q.defineRouting([M1],[M2]) ...@@ -31,34 +19,26 @@ Q.defineRouting([M1],[M2])
M2.defineRouting([Q],[E]) M2.defineRouting([Q],[E])
E.defineRouting([M2]) E.defineRouting([M2])
def main(): def main():
#initialize all the objects # add all the objects in a list
for object in G.ObjList + G.ObjectInterruptionList + G.ObjectResourceList: objectList=[S,M1,M2,E,Q,R,F1,F2]
object.initialize() # set the length of the experiment
maxSimTime=1440.0
#activate all the objects # call the runSimulation giving the objects and the length of the experiment
for object in G.ObjList + G.ObjectInterruptionList: runSimulation(objectList, maxSimTime)
G.env.process(object.run())
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
G.env.run(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList + G.ObjectResourceList:
object.postProcessing()
#print the results #print the results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
blockage_ratio = (M1.totalBlockageTime/G.maxSimTime)*100 blockage_ratio = (M1.totalBlockageTime/maxSimTime)*100
working_ratio = (R.totalWorkingTime/G.maxSimTime)*100 blockage_ratio = (M1.totalBlockageTime/maxSimTime)*100
waiting_ratio = (R.totalWaitingTime/G.maxSimTime)*100 working_ratio = (R.totalWorkingTime/maxSimTime)*100
waiting_ratio = (R.totalWaitingTime/maxSimTime)*100
print "the blockage ratio of", M1.objName, "is", blockage_ratio, "%" print "the blockage ratio of", M1.objName, "is", blockage_ratio, "%"
print "the working ratio of", R.objName,"is", working_ratio, "%" print "the working ratio of", R.objName,"is", working_ratio, "%"
#create a graph object #create a graph object
from dream.KnowledgeExtraction.Plots import Graphs
graph=Graphs() graph=Graphs()
#create the pie #create the pie
graph.Pie([working_ratio,waiting_ratio], "repairmanPie.jpg") graph.Pie([working_ratio,waiting_ratio], "repairmanPie.jpg")
......
from dream.simulation.imports import Machine, Source, Exit, Part, G, Repairman, Queue, Failure from dream.simulation.imports import Machine, Source, Exit, Part, Repairman, Queue, Failure
from dream.simulation.imports import simpy from dream.simulation.Globals import runSimulation
#define the objects of the model #define the objects of the model
R=Repairman('R1', 'Bob') R=Repairman('R1', 'Bob')
...@@ -8,16 +8,10 @@ M1=Machine('M1','Machine1', processingTime={'distributionType':'Normal','mean':0 ...@@ -8,16 +8,10 @@ M1=Machine('M1','Machine1', processingTime={'distributionType':'Normal','mean':0
M2=Machine('M2','Machine2', processingTime={'distributionType':'Normal','mean':1.5,'stdev':0.3,'min':0.5,'max':5}) M2=Machine('M2','Machine2', processingTime={'distributionType':'Normal','mean':1.5,'stdev':0.3,'min':0.5,'max':5})
Q=Queue('Q1','Queue') Q=Queue('Q1','Queue')
E=Exit('E1','Exit') E=Exit('E1','Exit')
#create failures #create failures
F1=Failure(victim=M1, distribution={'distributionType':'Fixed','MTTF':60,'MTTR':5}, 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) F2=Failure(victim=M2, distribution={'distributionType':'Fixed','MTTF':40,'MTTR':10}, repairman=R)
#add objects in lists so that they can be easier accessed later
G.ObjList=[S,M1,M2,E,Q]
G.ObjectResourceList=[R]
G.ObjectInterruptionList=[F1,F2]
#define predecessors and successors for the objects #define predecessors and successors for the objects
S.defineRouting([M1]) S.defineRouting([M1])
M1.defineRouting([S],[Q]) M1.defineRouting([S],[Q])
...@@ -25,48 +19,26 @@ Q.defineRouting([M1],[M2]) ...@@ -25,48 +19,26 @@ Q.defineRouting([M1],[M2])
M2.defineRouting([Q],[E]) M2.defineRouting([Q],[E])
E.defineRouting([M2]) E.defineRouting([M2])
G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
G.numberOfReplications=10 #set 10 replications
G.confidenceLevel=0.99 #set the confidence level. 0.99=99%
def main(): def main():
throughputList=[] # a list to hold the throughput of each replication
#run the replications
for i in range(G.numberOfReplications):
G.seed+=1 #increment the seed so that we get different random numbers in each run.
G.env=simpy.Environment() # define a simpy environment
# this is where all the simulation object 'live'
#initialize all the objects
for object in G.ObjList + G.ObjectInterruptionList + G.ObjectResourceList:
object.initialize()
#activate all the objects
for object in G.ObjList + G.ObjectInterruptionList:
G.env.process(object.run())
G.env.run(until=G.maxSimTime) #run the simulation
#carry on the post processing operations for every object in the topology
for object in G.ObjList + G.ObjectResourceList:
object.postProcessing()
# append the number of exits in the throughputList # add all the objects in a list
throughputList.append(E.numOfExits) 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, numberOfReplications=10, seed=1)
print 'The exit of each replication is:' print 'The exit of each replication is:'
print throughputList print E.Exits
# calculate confidence interval using the Knowledge Extraction tool # calculate confidence interval using the Knowledge Extraction tool
from dream.KnowledgeExtraction.ConfidenceIntervals import Intervals from dream.KnowledgeExtraction.ConfidenceIntervals import Intervals
from dream.KnowledgeExtraction.StatisticalMeasures import BasicStatisticalMeasures from dream.KnowledgeExtraction.StatisticalMeasures import BasicStatisticalMeasures
BSM=BasicStatisticalMeasures() BSM=BasicStatisticalMeasures()
lb, ub = Intervals().ConfidIntervals(throughputList, 0.95) lb, ub = Intervals().ConfidIntervals(E.Exits, 0.95)
print 'the 95% confidence interval for the throughput is:' print 'the 95% confidence interval for the throughput is:'
print 'lower bound:', lb print 'lower bound:', lb
print 'mean:', BSM.mean(throughputList) print 'mean:', BSM.mean(E.Exits)
print 'upper bound:', ub print 'upper bound:', ub
if __name__ == '__main__': if __name__ == '__main__':
......
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