Commit 357dd57c authored by Georgios Dagkakis's avatar Georgios Dagkakis

examples editted not to print in test mode

parent 80b518d9
...@@ -18,7 +18,7 @@ A.defineRouting([Sp,Sf],[M]) ...@@ -18,7 +18,7 @@ A.defineRouting([Sp,Sf],[M])
M.defineRouting([A],[E]) M.defineRouting([A],[E])
E.defineRouting([M]) E.defineRouting([M])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[Sp,Sf,M,A,E,F] objectList=[Sp,Sf,M,A,E,F]
# set the length of the experiment # set the length of the experiment
...@@ -26,13 +26,19 @@ def main(): ...@@ -26,13 +26,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "frames"
working_ratio=(A.totalWorkingTime/maxSimTime)*100 working_ratio=(A.totalWorkingTime/maxSimTime)*100
print "the working ratio of", A.objName, "is", working_ratio, "%"
# return results for the test
if test:
return {"frames": E.numOfExits, return {"frames": E.numOfExits,
"working_ratio": working_ratio} "working_ratio": working_ratio}
# print the results
print "the system produced", E.numOfExits, "frames"
print "the working ratio of", A.objName, "is", working_ratio, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -39,7 +39,7 @@ Q.defineRouting(successorList=[M]) ...@@ -39,7 +39,7 @@ Q.defineRouting(successorList=[M])
M.defineRouting(predecessorList=[Q],successorList=[E]) M.defineRouting(predecessorList=[Q],successorList=[E])
E.defineRouting(predecessorList=[M]) E.defineRouting(predecessorList=[M])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[Q,M,E,EV] objectList=[Q,M,E,EV]
# set the length of the experiment # set the length of the experiment
...@@ -47,13 +47,19 @@ def main(): ...@@ -47,13 +47,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
# calculate metrics
working_ratio = (M.totalWorkingTime/maxSimTime)*100
# return results for the test
if test:
return {"parts": E.numOfExits,
"working_ratio": working_ratio}
#print the results #print the results
print '='*50 print '='*50
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
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,
"working_ratio": working_ratio}
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -49,22 +49,27 @@ E.defineRouting(predecessorList=[M]) ...@@ -49,22 +49,27 @@ E.defineRouting(predecessorList=[M])
EV=EventGenerator('EV', 'PredecessorChanger', start=0, stop=50, interval=10,method=changeMachinePredecessor, EV=EventGenerator('EV', 'PredecessorChanger', start=0, stop=50, interval=10,method=changeMachinePredecessor,
argumentDict={'machine':M, 'possiblePredecessors':[Q1,Q2]}) argumentDict={'machine':M, 'possiblePredecessors':[Q1,Q2]})
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[Q1,Q2,M,E,EV]+entityList objectList=[Q1,Q2,M,E,EV]+entityList
# set the length of the experiment # set the length of the experiment
maxSimTime=float('inf') maxSimTime=float('inf')
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime, trace='Yes') runSimulation(objectList, maxSimTime, trace='Yes')
# calculate metrics
working_ratio = (M.totalWorkingTime/E.timeLastEntityLeft)*100
# return results for the test
if test:
return {"parts": E.numOfExits,
"simulationTime":E.timeLastEntityLeft,
"working_ratio": working_ratio}
#print the results #print the results
print '='*50 print '='*50
print "the system produced", E.numOfExits, "parts in", E.timeLastEntityLeft, "minutes" print "the system produced", E.numOfExits, "parts in", E.timeLastEntityLeft, "minutes"
working_ratio = (M.totalWorkingTime/E.timeLastEntityLeft)*100
print "the total working ratio of the Machine is", working_ratio, "%" print "the total working ratio of the Machine is", working_ratio, "%"
ExcelHandler.outputTrace('ChangingPredecessors') ExcelHandler.outputTrace('ChangingPredecessors')
return {"parts": E.numOfExits,
"simulationTime":E.timeLastEntityLeft,
"working_ratio": working_ratio}
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -24,7 +24,7 @@ BRA.defineRouting([M2],[M3]) ...@@ -24,7 +24,7 @@ BRA.defineRouting([M2],[M3])
M3.defineRouting([BRA],[E]) M3.defineRouting([BRA],[E])
E.defineRouting([M3]) E.defineRouting([M3])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,Q,BD,M1,Q1,M2,BRA,M3,E] objectList=[S,Q,BD,M1,Q1,M2,BRA,M3,E]
...@@ -33,28 +33,19 @@ def main(): ...@@ -33,28 +33,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime, trace='Yes') runSimulation(objectList, maxSimTime, trace='Yes')
# print the results # calculate metrics
print "the system produced", E.numOfExits, "batches"
working_ratio_M1 = (M1.totalWorkingTime/maxSimTime)*100 working_ratio_M1 = (M1.totalWorkingTime/maxSimTime)*100
blockage_ratio_M1 = (M1.totalBlockageTime/maxSimTime)*100 blockage_ratio_M1 = (M1.totalBlockageTime/maxSimTime)*100
waiting_ratio_M1 = (M1.totalWaitingTime/maxSimTime)*100 waiting_ratio_M1 = (M1.totalWaitingTime/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/maxSimTime)*100 working_ratio_M2 = (M2.totalWorkingTime/maxSimTime)*100
blockage_ratio_M2 = (M2.totalBlockageTime/maxSimTime)*100 blockage_ratio_M2 = (M2.totalBlockageTime/maxSimTime)*100
waiting_ratio_M2 = (M2.totalWaitingTime/maxSimTime)*100 waiting_ratio_M2 = (M2.totalWaitingTime/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/maxSimTime)*100 working_ratio_M3 = (M3.totalWorkingTime/maxSimTime)*100
blockage_ratio_M3 = (M3.totalBlockageTime/maxSimTime)*100 blockage_ratio_M3 = (M3.totalBlockageTime/maxSimTime)*100
waiting_ratio_M3 = (M3.totalWaitingTime/maxSimTime)*100 waiting_ratio_M3 = (M3.totalWaitingTime/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
ExcelHandler.outputTrace('TRACE')
# return results for the test
if test:
return {"batches": E.numOfExits, return {"batches": E.numOfExits,
"working_ratio_M1": working_ratio_M1, "working_ratio_M1": working_ratio_M1,
"blockage_ratio_M1": blockage_ratio_M1, "blockage_ratio_M1": blockage_ratio_M1,
...@@ -67,5 +58,18 @@ def main(): ...@@ -67,5 +58,18 @@ def main():
"waiting_ratio_M3": waiting_ratio_M3, "waiting_ratio_M3": waiting_ratio_M3,
} }
# print the results
print "the system produced", E.numOfExits, "batches"
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
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
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
ExcelHandler.outputTrace('TRACE')
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -15,7 +15,7 @@ BD.defineRouting([Q],[M]) ...@@ -15,7 +15,7 @@ BD.defineRouting([Q],[M])
M.defineRouting([BD],[E]) M.defineRouting([BD],[E])
E.defineRouting([M]) E.defineRouting([M])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,Q,BD,M,E] objectList=[S,Q,BD,M,E]
...@@ -24,18 +24,24 @@ def main(): ...@@ -24,18 +24,24 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
# print the results # calculate metrics
print "the system produced", E.numOfExits, "subbatches"
working_ratio = (M.totalWorkingTime/maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
blockage_ratio = (M.totalBlockageTime/maxSimTime)*100 blockage_ratio = (M.totalBlockageTime/maxSimTime)*100
waiting_ratio = (M.totalWaitingTime/maxSimTime)*100 waiting_ratio = (M.totalWaitingTime/maxSimTime)*100
print "the working ratio of", M.objName, "is", working_ratio
print "the blockage ratio of", M.objName, 'is', blockage_ratio # return results for the test
print "the waiting ratio of", M.objName, 'is', waiting_ratio if test:
return {"subbatches": E.numOfExits, return {"subbatches": E.numOfExits,
"working_ratio": working_ratio, "working_ratio": working_ratio,
"blockage_ratio": blockage_ratio, "blockage_ratio": blockage_ratio,
"waiting_ratio": waiting_ratio} "waiting_ratio": waiting_ratio}
# print the results
print "the system produced", E.numOfExits, "subbatches"
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
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -21,7 +21,7 @@ route=[{"stationIdsList": ["Q1"]}, ...@@ -21,7 +21,7 @@ route=[{"stationIdsList": ["Q1"]},
#define the Jobs #define the Jobs
J=Job('J1','Job1',route=route) J=Job('J1','Job1',route=route)
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[M1,M2,M3,Q1,Q2,Q3,E,J] objectList=[M1,M2,M3,Q1,Q2,Q3,E,J]
# set the length of the experiment # set the length of the experiment
...@@ -29,12 +29,16 @@ def main(): ...@@ -29,12 +29,16 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#loop in the schedule to print the results # return results for the test
returnSchedule=[] # dummy variable used just for returning values and testing if test:
returnSchedule=[]
for record in J.schedule: for record in J.schedule:
returnSchedule.append([record[0].objName,record[1]]) returnSchedule.append([record[0].objName,record[1]])
print J.name, "got into", record[0].objName, "at", record[1]
return returnSchedule return returnSchedule
# print the results
for record in J.schedule:
print J.name, "got into", record[0].objName, "at", record[1]
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -44,7 +44,7 @@ J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100) ...@@ -44,7 +44,7 @@ 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)
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3] objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3]
# set the length of the experiment # set the length of the experiment
...@@ -52,17 +52,19 @@ def main(): ...@@ -52,17 +52,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#output the schedule of every job # return results for the test
returnSchedule=[] # dummy variable used just for returning values and testing if test:
returnSchedule=[]
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
#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
name=None
returnSchedule.append([record[0].objName,record[1]]) returnSchedule.append([record[0].objName,record[1]])
return returnSchedule
# print the results
for job in [J1,J2,J3]:
for record in job.schedule:
print job.name, "got into", record[0].objName, "at", record[1] print job.name, "got into", record[0].objName, "at", record[1]
print "-"*30 print "-"*30
return returnSchedule
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -44,7 +44,7 @@ J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100) ...@@ -44,7 +44,7 @@ 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)
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3] objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3]
# set the length of the experiment # set the length of the experiment
...@@ -52,17 +52,19 @@ def main(): ...@@ -52,17 +52,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#output the schedule of every job # return results for the test
returnSchedule=[] # dummy variable used just for returning values and testing if test:
returnSchedule=[]
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
#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
name=None
returnSchedule.append([record[0].objName,record[1]]) returnSchedule.append([record[0].objName,record[1]])
return returnSchedule
# print the results
for job in [J1,J2,J3]:
for record in job.schedule:
print job.name, "got into", record[0].objName, "at", record[1] print job.name, "got into", record[0].objName, "at", record[1]
print "-"*30 print "-"*30
return returnSchedule
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -44,7 +44,7 @@ J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100) ...@@ -44,7 +44,7 @@ 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)
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3] objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3]
# set the length of the experiment # set the length of the experiment
...@@ -52,17 +52,19 @@ def main(): ...@@ -52,17 +52,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#output the schedule of every job # return results for the test
returnSchedule=[] # dummy variable used just for returning values and testing if test:
returnSchedule=[]
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
#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
name=None
returnSchedule.append([record[0].objName,record[1]]) returnSchedule.append([record[0].objName,record[1]])
return returnSchedule
# print the results
for job in [J1,J2,J3]:
for record in job.schedule:
print job.name, "got into", record[0].objName, "at", record[1] print job.name, "got into", record[0].objName, "at", record[1]
print "-"*30 print "-"*30
return returnSchedule
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -44,7 +44,7 @@ J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100) ...@@ -44,7 +44,7 @@ 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)
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3] objectList=[M1,M2,M3,Q1,Q2,Q3,E,J1,J2,J3]
# set the length of the experiment # set the length of the experiment
...@@ -52,17 +52,19 @@ def main(): ...@@ -52,17 +52,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#output the schedule of every job # return results for the test
returnSchedule=[] # dummy variable used just for returning values and testing if test:
returnSchedule=[]
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
#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
name=None
returnSchedule.append([record[0].objName,record[1]]) returnSchedule.append([record[0].objName,record[1]])
return returnSchedule
# print the results
for job in [J1,J2,J3]:
for record in job.schedule:
print job.name, "got into", record[0].objName, "at", record[1] print job.name, "got into", record[0].objName, "at", record[1]
print "-"*30 print "-"*30
return returnSchedule
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -11,7 +11,7 @@ NS.defineRouting(successorList=[M]) ...@@ -11,7 +11,7 @@ NS.defineRouting(successorList=[M])
M.defineRouting(predecessorList=[NS],successorList=[E]) M.defineRouting(predecessorList=[NS],successorList=[E])
E.defineRouting(predecessorList=[M]) E.defineRouting(predecessorList=[M])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[NS,M,E] objectList=[NS,M,E]
# set the length of the experiment # set the length of the experiment
...@@ -19,12 +19,17 @@ def main(): ...@@ -19,12 +19,17 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%"
# return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"working_ratio": working_ratio} "working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the total working ratio of the Machine is", working_ratio, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -11,7 +11,7 @@ NS.defineRouting(successorList=[M]) ...@@ -11,7 +11,7 @@ NS.defineRouting(successorList=[M])
M.defineRouting(predecessorList=[NS],successorList=[E]) M.defineRouting(predecessorList=[NS],successorList=[E])
E.defineRouting(predecessorList=[M]) E.defineRouting(predecessorList=[M])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[NS,M,E] objectList=[NS,M,E]
# set the length of the experiment # set the length of the experiment
...@@ -19,12 +19,17 @@ def main(): ...@@ -19,12 +19,17 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "batches"
working_ratio = (M.totalWorkingTime/maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%"
# return results for the test
if test:
return {"batches": E.numOfExits, return {"batches": E.numOfExits,
"working_ratio": working_ratio} "working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "batches"
print "the total working ratio of the Machine is", working_ratio, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -16,7 +16,7 @@ M1.defineRouting([Q],[E]) ...@@ -16,7 +16,7 @@ M1.defineRouting([Q],[E])
M2.defineRouting([Q],[E]) M2.defineRouting([Q],[E])
E.defineRouting([M1,M2]) E.defineRouting([M1,M2])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,Q,M1,M2,E,F] objectList=[S,Q,M1,M2,E,F]
...@@ -25,16 +25,21 @@ def main(): ...@@ -25,16 +25,21 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
working_ratio_M1=(M1.totalWorkingTime/maxSimTime)*100 working_ratio_M1=(M1.totalWorkingTime/maxSimTime)*100
working_ratio_M2=(M2.totalWorkingTime/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", M2.objName, "is", working_ratio_M2, "%" # return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"working_ratio_M1": working_ratio_M1, "working_ratio_M1": working_ratio_M1,
"working_ratio_M2": working_ratio_M2} "working_ratio_M2": working_ratio_M2}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the working ratio of", M1.objName, "is", working_ratio_M1, "%"
print "the working ratio of", M2.objName, "is", working_ratio_M2, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -26,7 +26,7 @@ M1.defineRouting([Q],[E]) ...@@ -26,7 +26,7 @@ M1.defineRouting([Q],[E])
M2.defineRouting([Q],[E]) M2.defineRouting([Q],[E])
E.defineRouting([M1,M2]) E.defineRouting([M1,M2])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,Q,M1,M2,E,F] objectList=[S,Q,M1,M2,E,F]
...@@ -35,15 +35,20 @@ def main(): ...@@ -35,15 +35,20 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
working_ratio_M1=(M1.totalWorkingTime/maxSimTime)*100 working_ratio_M1=(M1.totalWorkingTime/maxSimTime)*100
working_ratio_M2=(M2.totalWorkingTime/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", M2.objName, "is", working_ratio_M2, "%" # return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"working_ratio_M1": working_ratio_M1, "working_ratio_M1": working_ratio_M1,
"working_ratio_M2": working_ratio_M2} "working_ratio_M2": working_ratio_M2}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the working ratio of", M1.objName, "is", working_ratio_M1, "%"
print "the working ratio of", M2.objName, "is", working_ratio_M2, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -32,7 +32,7 @@ M1.defineRouting([Q],[E]) ...@@ -32,7 +32,7 @@ M1.defineRouting([Q],[E])
M2.defineRouting([Q],[E]) M2.defineRouting([Q],[E])
E.defineRouting([M1,M2]) E.defineRouting([M1,M2])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,Q,M1,M2,E,F] objectList=[S,Q,M1,M2,E,F]
...@@ -41,16 +41,20 @@ def main(): ...@@ -41,16 +41,20 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
working_ratio_M1=(M1.totalWorkingTime/maxSimTime)*100 working_ratio_M1=(M1.totalWorkingTime/maxSimTime)*100
working_ratio_M2=(M2.totalWorkingTime/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", M2.objName, "is", working_ratio_M2, "%" # return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"working_ratio_M1": working_ratio_M1, "working_ratio_M1": working_ratio_M1,
"working_ratio_M2": working_ratio_M2, "working_ratio_M2": working_ratio_M2}
}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the working ratio of", M1.objName, "is", working_ratio_M1, "%"
print "the working ratio of", M2.objName, "is", working_ratio_M2, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -55,7 +55,7 @@ M1.defineRouting([Q],[E]) ...@@ -55,7 +55,7 @@ M1.defineRouting([Q],[E])
M2.defineRouting([Q],[E]) M2.defineRouting([Q],[E])
E.defineRouting([M1,M2]) E.defineRouting([M1,M2])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,Q,M1,M2,E,F] objectList=[S,Q,M1,M2,E,F]
...@@ -64,19 +64,25 @@ def main(): ...@@ -64,19 +64,25 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
working_ratio_M1=(M1.totalWorkingTime/maxSimTime)*100 working_ratio_M1=(M1.totalWorkingTime/maxSimTime)*100
working_ratio_M2=(M2.totalWorkingTime/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", M2.objName, "is", working_ratio_M2, "%" # return results for the test
print M1.objName, "produced", G.NumM1, "parts" if test:
print M2.objName, "produced", G.NumM2, "parts"
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"working_ratio_M1": working_ratio_M1, "working_ratio_M1": working_ratio_M1,
"working_ratio_M2": working_ratio_M2, "working_ratio_M2": working_ratio_M2,
"NumM1":G.NumM1, "NumM1":G.NumM1,
"NumM2":G.NumM2} "NumM2":G.NumM2}
#print the results
print "the system produced", E.numOfExits, "parts"
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"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -23,7 +23,7 @@ BRA.defineRouting([M2],[M3]) ...@@ -23,7 +23,7 @@ BRA.defineRouting([M2],[M3])
M3.defineRouting([BRA],[E]) M3.defineRouting([BRA],[E])
E.defineRouting([M3]) E.defineRouting([M3])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,Q,BD,M1,Q1,M2,BRA,M3,E] objectList=[S,Q,BD,M1,Q1,M2,BRA,M3,E]
# set the length of the experiment # set the length of the experiment
...@@ -31,27 +31,19 @@ def main(): ...@@ -31,27 +31,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
# print the results # calculate metrics
print "the system produced", E.numOfExits, "batches"
working_ratio_M1 = (M1.totalWorkingTime/maxSimTime)*100 working_ratio_M1 = (M1.totalWorkingTime/maxSimTime)*100
blockage_ratio_M1 = (M1.totalBlockageTime/maxSimTime)*100 blockage_ratio_M1 = (M1.totalBlockageTime/maxSimTime)*100
waiting_ratio_M1 = (M1.totalWaitingTime/maxSimTime)*100 waiting_ratio_M1 = (M1.totalWaitingTime/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/maxSimTime)*100 working_ratio_M2 = (M2.totalWorkingTime/maxSimTime)*100
blockage_ratio_M2 = (M2.totalBlockageTime/maxSimTime)*100 blockage_ratio_M2 = (M2.totalBlockageTime/maxSimTime)*100
waiting_ratio_M2 = (M2.totalWaitingTime/maxSimTime)*100 waiting_ratio_M2 = (M2.totalWaitingTime/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/maxSimTime)*100 working_ratio_M3 = (M3.totalWorkingTime/maxSimTime)*100
blockage_ratio_M3 = (M3.totalBlockageTime/maxSimTime)*100 blockage_ratio_M3 = (M3.totalBlockageTime/maxSimTime)*100
waiting_ratio_M3 = (M3.totalWaitingTime/maxSimTime)*100 waiting_ratio_M3 = (M3.totalWaitingTime/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 results for the test
if test:
return {"batches": E.numOfExits, return {"batches": E.numOfExits,
"working_ratio_M1": working_ratio_M1, "working_ratio_M1": working_ratio_M1,
"blockage_ratio_M1": blockage_ratio_M1, "blockage_ratio_M1": blockage_ratio_M1,
...@@ -64,5 +56,17 @@ def main(): ...@@ -64,5 +56,17 @@ def main():
"waiting_ratio_M3": waiting_ratio_M3, "waiting_ratio_M3": waiting_ratio_M3,
} }
# print the results
print "the system produced", E.numOfExits, "batches"
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
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
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
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -13,7 +13,7 @@ S.defineRouting(successorList=[M]) ...@@ -13,7 +13,7 @@ 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(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,M,E,SS] objectList=[S,M,E,SS]
...@@ -22,14 +22,19 @@ def main(): ...@@ -22,14 +22,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100 off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%" # return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"working_ratio": working_ratio} "working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -22,7 +22,7 @@ S.defineRouting(successorList=[M]) ...@@ -22,7 +22,7 @@ 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(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,M,E,SS] objectList=[S,M,E,SS]
...@@ -31,14 +31,19 @@ def main(): ...@@ -31,14 +31,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100 off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%" # return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"working_ratio": working_ratio} "working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -13,7 +13,7 @@ S.defineRouting(successorList=[M]) ...@@ -13,7 +13,7 @@ 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(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,M,E,SS] objectList=[S,M,E,SS]
...@@ -22,14 +22,19 @@ def main(): ...@@ -22,14 +22,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100 off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%" # return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"working_ratio": working_ratio} "working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -13,7 +13,7 @@ S.defineRouting(successorList=[M]) ...@@ -13,7 +13,7 @@ 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(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,M,E,SS] objectList=[S,M,E,SS]
...@@ -22,14 +22,19 @@ def main(): ...@@ -22,14 +22,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100 off_shift_ratio=(M.totalOffShiftTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%" # return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"working_ratio": working_ratio} "working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the total working ratio of the Machine is", working_ratio, "%"
print "the total off-shift ratio of the Machine is", off_shift_ratio, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -12,7 +12,7 @@ Q.defineRouting(successorList=[M]) ...@@ -12,7 +12,7 @@ Q.defineRouting(successorList=[M])
M.defineRouting(predecessorList=[Q],successorList=[E]) M.defineRouting(predecessorList=[Q],successorList=[E])
E.defineRouting(predecessorList=[M]) E.defineRouting(predecessorList=[M])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[Q,M,E,P1] objectList=[Q,M,E,P1]
# set the length of the experiment # set the length of the experiment
...@@ -20,14 +20,19 @@ def main(): ...@@ -20,14 +20,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime, trace='Yes') runSimulation(objectList, maxSimTime, trace='Yes')
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts in", E.timeLastEntityLeft, "minutes"
working_ratio = (M.totalWorkingTime/G.maxSimTime)*100 working_ratio = (M.totalWorkingTime/G.maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%"
ExcelHandler.outputTrace('Wip1') # return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"simulationTime":E.timeLastEntityLeft, "simulationTime":E.timeLastEntityLeft,
"working_ratio": working_ratio} "working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts in", E.timeLastEntityLeft, "minutes"
print "the total working ratio of the Machine is", working_ratio, "%"
ExcelHandler.outputTrace('Wip1')
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -13,7 +13,7 @@ Q.defineRouting(successorList=[M]) ...@@ -13,7 +13,7 @@ Q.defineRouting(successorList=[M])
M.defineRouting(predecessorList=[Q],successorList=[E]) M.defineRouting(predecessorList=[Q],successorList=[E])
E.defineRouting(predecessorList=[M]) E.defineRouting(predecessorList=[M])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[Q,M,E,P1,P2] objectList=[Q,M,E,P1,P2]
# set the length of the experiment # set the length of the experiment
...@@ -21,14 +21,19 @@ def main(): ...@@ -21,14 +21,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime, trace='Yes') runSimulation(objectList, maxSimTime, trace='Yes')
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts in", E.timeLastEntityLeft, "minutes"
working_ratio = (M.totalWorkingTime/G.maxSimTime)*100 working_ratio = (M.totalWorkingTime/G.maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%"
ExcelHandler.outputTrace('Wip2') # return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"simulationTime":E.timeLastEntityLeft, "simulationTime":E.timeLastEntityLeft,
"working_ratio": working_ratio} "working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts in", E.timeLastEntityLeft, "minutes"
print "the total working ratio of the Machine is", working_ratio, "%"
ExcelHandler.outputTrace('Wip2')
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -13,7 +13,7 @@ Q.defineRouting(successorList=[M]) ...@@ -13,7 +13,7 @@ Q.defineRouting(successorList=[M])
M.defineRouting(predecessorList=[Q],successorList=[E]) M.defineRouting(predecessorList=[Q],successorList=[E])
E.defineRouting(predecessorList=[M]) E.defineRouting(predecessorList=[M])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[Q,M,E,P1,P2] objectList=[Q,M,E,P1,P2]
# set the length of the experiment # set the length of the experiment
...@@ -21,14 +21,19 @@ def main(): ...@@ -21,14 +21,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime, trace='Yes') runSimulation(objectList, maxSimTime, trace='Yes')
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts in", E.timeLastEntityLeft, "minutes"
working_ratio = (M.totalWorkingTime/G.maxSimTime)*100 working_ratio = (M.totalWorkingTime/G.maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%"
ExcelHandler.outputTrace('Wip3') # return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"simulationTime":E.timeLastEntityLeft, "simulationTime":E.timeLastEntityLeft,
"working_ratio": working_ratio} "working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts in", E.timeLastEntityLeft, "minutes"
print "the total working ratio of the Machine is", working_ratio, "%"
ExcelHandler.outputTrace('Wip1')
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -11,7 +11,7 @@ S.defineRouting(successorList=[M]) ...@@ -11,7 +11,7 @@ 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(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,M,E] objectList=[S,M,E]
# set the length of the experiment # set the length of the experiment
...@@ -19,12 +19,18 @@ def main(): ...@@ -19,12 +19,18 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
working_ratio = (M.totalWorkingTime/maxSimTime)*100 working_ratio = (M.totalWorkingTime/maxSimTime)*100
print "the total working ratio of the Machine is", working_ratio, "%"
# return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"working_ratio": working_ratio} "working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the total working ratio of the Machine is", working_ratio, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -19,7 +19,7 @@ Q.defineRouting([M1],[M2]) ...@@ -19,7 +19,7 @@ Q.defineRouting([M1],[M2])
M2.defineRouting([Q],[E]) M2.defineRouting([Q],[E])
E.defineRouting([M2]) E.defineRouting([M2])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,M1,M2,E,Q,R,F1,F2] objectList=[S,M1,M2,E,Q,R,F1,F2]
...@@ -28,15 +28,21 @@ def main(): ...@@ -28,15 +28,21 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
blockage_ratio = (M1.totalBlockageTime/maxSimTime)*100 blockage_ratio = (M1.totalBlockageTime/maxSimTime)*100
working_ratio = (R.totalWorkingTime/maxSimTime)*100 working_ratio = (R.totalWorkingTime/maxSimTime)*100
print "the blockage ratio of", M1.objName, "is", blockage_ratio, "%"
print "the working ratio of", R.objName,"is", working_ratio, "%" # return results for the test
if test:
return {"parts": E.numOfExits, return {"parts": E.numOfExits,
"blockage_ratio": blockage_ratio, "blockage_ratio": blockage_ratio,
"working_ratio": working_ratio} "working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts"
print "the blockage ratio of", M1.objName, "is", blockage_ratio, "%"
print "the working ratio of", R.objName,"is", working_ratio, "%"
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -19,7 +19,7 @@ Q.defineRouting([M1],[M2]) ...@@ -19,7 +19,7 @@ Q.defineRouting([M1],[M2])
M2.defineRouting([Q],[E]) M2.defineRouting([Q],[E])
E.defineRouting([M2]) E.defineRouting([M2])
def main(): def main(test=0):
# add all the objects in a list # add all the objects in a list
objectList=[S,M1,M2,E,Q,R,F1,F2] objectList=[S,M1,M2,E,Q,R,F1,F2]
...@@ -28,12 +28,20 @@ def main(): ...@@ -28,12 +28,20 @@ def main():
# call the runSimulation giving the objects and the length of the experiment # call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList, maxSimTime) runSimulation(objectList, maxSimTime)
#print the results # calculate metrics
print "the system produced", E.numOfExits, "parts"
blockage_ratio = (M1.totalBlockageTime/maxSimTime)*100 blockage_ratio = (M1.totalBlockageTime/maxSimTime)*100
blockage_ratio = (M1.totalBlockageTime/maxSimTime)*100 blockage_ratio = (M1.totalBlockageTime/maxSimTime)*100
working_ratio = (R.totalWorkingTime/maxSimTime)*100 working_ratio = (R.totalWorkingTime/maxSimTime)*100
waiting_ratio = (R.totalWaitingTime/maxSimTime)*100 waiting_ratio = (R.totalWaitingTime/maxSimTime)*100
# return results for the test
if test:
return {"parts": E.numOfExits,
"blockage_ratio": blockage_ratio,
"working_ratio": working_ratio}
#print the results
print "the system produced", E.numOfExits, "parts"
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, "%"
...@@ -43,11 +51,6 @@ def main(): ...@@ -43,11 +51,6 @@ def main():
#create the pie #create the pie
graph.Pie([working_ratio,waiting_ratio], "repairmanPie.jpg") graph.Pie([working_ratio,waiting_ratio], "repairmanPie.jpg")
return {"parts": E.numOfExits,
"blockage_ratio": blockage_ratio,
"working_ratio": working_ratio}
if __name__ == '__main__': if __name__ == '__main__':
main() main()
......
...@@ -36,26 +36,26 @@ class SimulationExamples(TestCase): ...@@ -36,26 +36,26 @@ class SimulationExamples(TestCase):
""" """
def testTwoServers(self): def testTwoServers(self):
from dream.simulation.Examples.TwoServers import main from dream.simulation.Examples.TwoServers import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 732) self.assertEquals(result['parts'], 732)
self.assertTrue(78.17 < result["blockage_ratio"] < 78.18) self.assertTrue(78.17 < result["blockage_ratio"] < 78.18)
self.assertTrue(26.73 < result["working_ratio"] < 27.74) self.assertTrue(26.73 < result["working_ratio"] < 27.74)
def testAssemblyLine(self): def testAssemblyLine(self):
from dream.simulation.Examples.AssemblyLine import main from dream.simulation.Examples.AssemblyLine import main
result = main() result = main(test=1)
self.assertEquals(result['frames'], 664) self.assertEquals(result['frames'], 664)
self.assertTrue(92.36 < result["working_ratio"] < 93.37) self.assertTrue(92.36 < result["working_ratio"] < 93.37)
def testSingleServer(self): def testSingleServer(self):
from dream.simulation.Examples.SingleServer import main from dream.simulation.Examples.SingleServer import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 2880) self.assertEquals(result['parts'], 2880)
self.assertTrue(49.99 < result["working_ratio"] < 50.01) self.assertTrue(49.99 < result["working_ratio"] < 50.01)
def testClearBatchLines(self): def testClearBatchLines(self):
from dream.simulation.Examples.ClearBatchLines import main from dream.simulation.Examples.ClearBatchLines import main
result = main() result = main(test=1)
self.assertEquals(result['batches'], 89) self.assertEquals(result['batches'], 89)
self.assertTrue(0.069 < result["waiting_ratio_M1"] < 0.07) self.assertTrue(0.069 < result["waiting_ratio_M1"] < 0.07)
self.assertTrue(0.104 < result["waiting_ratio_M2"] < 0.105) self.assertTrue(0.104 < result["waiting_ratio_M2"] < 0.105)
...@@ -63,7 +63,7 @@ class SimulationExamples(TestCase): ...@@ -63,7 +63,7 @@ class SimulationExamples(TestCase):
def testDecompositionOfBatches(self): def testDecompositionOfBatches(self):
from dream.simulation.Examples.DecompositionOfBatches import main from dream.simulation.Examples.DecompositionOfBatches import main
result = main() result = main(test=1)
self.assertEquals(result['subbatches'], 2302) self.assertEquals(result['subbatches'], 2302)
self.assertTrue(79.96 < result["working_ratio"] < 79.97) self.assertTrue(79.96 < result["working_ratio"] < 79.97)
self.assertEquals(result["blockage_ratio"] , 0.0) self.assertEquals(result["blockage_ratio"] , 0.0)
...@@ -71,7 +71,7 @@ class SimulationExamples(TestCase): ...@@ -71,7 +71,7 @@ class SimulationExamples(TestCase):
def testSerialBatchProcessing(self): def testSerialBatchProcessing(self):
from dream.simulation.Examples.SerialBatchProcessing import main from dream.simulation.Examples.SerialBatchProcessing import main
result = main() result = main(test=1)
self.assertEquals(result['batches'], 359) self.assertEquals(result['batches'], 359)
self.assertTrue(0.104 < result["waiting_ratio_M1"] < 0.105) self.assertTrue(0.104 < result["waiting_ratio_M1"] < 0.105)
self.assertTrue(0.104 < result["waiting_ratio_M2"] < 0.105) self.assertTrue(0.104 < result["waiting_ratio_M2"] < 0.105)
...@@ -79,13 +79,13 @@ class SimulationExamples(TestCase): ...@@ -79,13 +79,13 @@ class SimulationExamples(TestCase):
def testJobShop1(self): def testJobShop1(self):
from dream.simulation.Examples.JobShop1 import main from dream.simulation.Examples.JobShop1 import main
result = main() result = main(test=1)
expectedResult=[['Queue1', 0], ['Machine1', 0], ['Queue3', 1.0], ['Machine3', 1.0], ['Queue2', 4.0], ['Machine2', 4.0], ['Exit', 6.0]] expectedResult=[['Queue1', 0], ['Machine1', 0], ['Queue3', 1.0], ['Machine3', 1.0], ['Queue2', 4.0], ['Machine2', 4.0], ['Exit', 6.0]]
self.assertEquals(result, expectedResult) self.assertEquals(result, expectedResult)
def testJobShop2EDD(self): def testJobShop2EDD(self):
from dream.simulation.Examples.JobShop2EDD import main from dream.simulation.Examples.JobShop2EDD import main
result = main() result = main(test=1)
expectedResult=[['Queue1', 0], ['Machine1', 2.0], ['Queue3', 3.0], ['Machine3', 3.0], ['Queue2', 6.0], ['Machine2', 6.0], ['Exit', 8.0], \ expectedResult=[['Queue1', 0], ['Machine1', 2.0], ['Queue3', 3.0], ['Machine3', 3.0], ['Queue2', 6.0], ['Machine2', 6.0], ['Exit', 8.0], \
['Queue1', 0], ['Machine1', 0], ['Queue2', 2.0], ['Machine2', 2.0], ['Queue3', 6.0], ['Machine3', 6.0], ['Exit', 12.0], ['Queue1', 0], \ ['Queue1', 0], ['Machine1', 0], ['Queue2', 2.0], ['Machine2', 2.0], ['Queue3', 6.0], ['Machine3', 6.0], ['Exit', 12.0], ['Queue1', 0], \
['Machine1', 3.0], ['Queue3', 13.0], ['Machine3', 13.0], ['Exit', 16.0]] ['Machine1', 3.0], ['Queue3', 13.0], ['Machine3', 13.0], ['Exit', 16.0]]
...@@ -93,7 +93,7 @@ class SimulationExamples(TestCase): ...@@ -93,7 +93,7 @@ class SimulationExamples(TestCase):
def testJobShop2MC(self): def testJobShop2MC(self):
from dream.simulation.Examples.JobShop2MC import main from dream.simulation.Examples.JobShop2MC import main
result = main() result = main(test=1)
expectedResult=[['Queue1', 0], ['Machine1', 12.0], ['Queue3', 13.0], ['Machine3', 13.0], ['Queue2', 16.0], \ expectedResult=[['Queue1', 0], ['Machine1', 12.0], ['Queue3', 13.0], ['Machine3', 13.0], ['Queue2', 16.0], \
['Machine2', 16.0], ['Exit', 18.0], ['Queue1', 0], ['Machine1', 10.0], ['Queue2', 12.0], ['Machine2', 12.0], \ ['Machine2', 16.0], ['Exit', 18.0], ['Queue1', 0], ['Machine1', 10.0], ['Queue2', 12.0], ['Machine2', 12.0], \
['Queue3', 16.0], ['Machine3', 16.0], ['Exit', 22.0], ['Queue1', 0], ['Machine1', 0], ['Queue3', 10.0], ['Machine3', 10.0], ['Exit', 13.0]] ['Queue3', 16.0], ['Machine3', 16.0], ['Exit', 22.0], ['Queue1', 0], ['Machine1', 0], ['Queue3', 10.0], ['Machine3', 10.0], ['Exit', 13.0]]
...@@ -101,7 +101,7 @@ class SimulationExamples(TestCase): ...@@ -101,7 +101,7 @@ class SimulationExamples(TestCase):
def testJobShop2Priority(self): def testJobShop2Priority(self):
from dream.simulation.Examples.JobShop2Priority import main from dream.simulation.Examples.JobShop2Priority import main
result = main() result = main(test=1)
expectedResult=[['Queue1', 0], ['Machine1', 10.0], ['Queue3', 11.0], ['Machine3', 13.0], ['Queue2', 16.0], \ expectedResult=[['Queue1', 0], ['Machine1', 10.0], ['Queue3', 11.0], ['Machine3', 13.0], ['Queue2', 16.0], \
['Machine2', 17.0], ['Exit', 19.0], ['Queue1', 0], ['Machine1', 11.0], ['Queue2', 13.0], ['Machine2', 13.0], ['Queue3', 17.0], \ ['Machine2', 17.0], ['Exit', 19.0], ['Queue1', 0], ['Machine1', 11.0], ['Queue2', 13.0], ['Machine2', 13.0], ['Queue3', 17.0], \
['Machine3', 17.0], ['Exit', 23.0], ['Queue1', 0], ['Machine1', 0], ['Queue3', 10.0], ['Machine3', 10.0], ['Exit', 13.0]] ['Machine3', 17.0], ['Exit', 23.0], ['Queue1', 0], ['Machine1', 0], ['Queue3', 10.0], ['Machine3', 10.0], ['Exit', 13.0]]
...@@ -109,7 +109,7 @@ class SimulationExamples(TestCase): ...@@ -109,7 +109,7 @@ class SimulationExamples(TestCase):
def testJobShop2RPC(self): def testJobShop2RPC(self):
from dream.simulation.Examples.JobShop2RPC import main from dream.simulation.Examples.JobShop2RPC import main
result = main() result = main(test=1)
expectedResult=[['Queue1', 0], ['Machine1', 12.0], ['Queue3', 13.0], ['Machine3', 13.0], ['Queue2', 16.0], \ expectedResult=[['Queue1', 0], ['Machine1', 12.0], ['Queue3', 13.0], ['Machine3', 13.0], ['Queue2', 16.0], \
['Machine2', 16.0], ['Exit', 18.0], ['Queue1', 0], ['Machine1', 10.0], ['Queue2', 12.0], ['Machine2', 12.0], ['Queue3', 16.0], \ ['Machine2', 16.0], ['Exit', 18.0], ['Queue1', 0], ['Machine1', 10.0], ['Queue2', 12.0], ['Machine2', 12.0], ['Queue3', 16.0], \
['Machine3', 16.0], ['Exit', 22.0], ['Queue1', 0], ['Machine1', 0], ['Queue3', 10.0], ['Machine3', 10.0], ['Exit', 13.0]] ['Machine3', 16.0], ['Exit', 22.0], ['Queue1', 0], ['Machine1', 0], ['Queue3', 10.0], ['Machine3', 10.0], ['Exit', 13.0]]
...@@ -117,14 +117,14 @@ class SimulationExamples(TestCase): ...@@ -117,14 +117,14 @@ class SimulationExamples(TestCase):
def testParallelServers1(self): def testParallelServers1(self):
from dream.simulation.Examples.ParallelServers1 import main from dream.simulation.Examples.ParallelServers1 import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 2880) self.assertEquals(result['parts'], 2880)
self.assertTrue(23.09 < result["working_ratio_M1"] < 23.1) self.assertTrue(23.09 < result["working_ratio_M1"] < 23.1)
self.assertTrue(26.9 < result["working_ratio_M2"] < 26.91) self.assertTrue(26.9 < result["working_ratio_M2"] < 26.91)
def testParallelServers2(self): def testParallelServers2(self):
from dream.simulation.Examples.ParallelServers3 import main from dream.simulation.Examples.ParallelServers3 import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 2880) self.assertEquals(result['parts'], 2880)
self.assertTrue(46.18 < result["working_ratio_M1"] < 46.19) self.assertTrue(46.18 < result["working_ratio_M1"] < 46.19)
self.assertTrue(3.81 < result["working_ratio_M2"] < 3.82) self.assertTrue(3.81 < result["working_ratio_M2"] < 3.82)
...@@ -132,7 +132,7 @@ class SimulationExamples(TestCase): ...@@ -132,7 +132,7 @@ class SimulationExamples(TestCase):
#NOTE: testParallelServers4 is extension of testParallelServers4 so this test really tests if they both run #NOTE: testParallelServers4 is extension of testParallelServers4 so this test really tests if they both run
def testParallelServers4(self): def testParallelServers4(self):
from dream.simulation.Examples.ParallelServers4 import main from dream.simulation.Examples.ParallelServers4 import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 2880) self.assertEquals(result['parts'], 2880)
self.assertTrue(46.18 < result["working_ratio_M1"] < 46.19) self.assertTrue(46.18 < result["working_ratio_M1"] < 46.19)
self.assertTrue(3.81 < result["working_ratio_M2"] < 3.82) self.assertTrue(3.81 < result["working_ratio_M2"] < 3.82)
...@@ -141,77 +141,77 @@ class SimulationExamples(TestCase): ...@@ -141,77 +141,77 @@ class SimulationExamples(TestCase):
def testServerWithShift1(self): def testServerWithShift1(self):
from dream.simulation.Examples.ServerWithShift1 import main from dream.simulation.Examples.ServerWithShift1 import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 3) self.assertEquals(result['parts'], 3)
self.assertTrue(49.99 < result["working_ratio"] < 50.01) self.assertTrue(49.99 < result["working_ratio"] < 50.01)
def testServerWithShift2(self): def testServerWithShift2(self):
from dream.simulation.Examples.ServerWithShift2 import main from dream.simulation.Examples.ServerWithShift2 import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 16) self.assertEquals(result['parts'], 16)
self.assertTrue(49.99 < result["working_ratio"] < 50.01) self.assertTrue(49.99 < result["working_ratio"] < 50.01)
def testServerWithShift3(self): def testServerWithShift3(self):
from dream.simulation.Examples.ServerWithShift3 import main from dream.simulation.Examples.ServerWithShift3 import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 4) self.assertEquals(result['parts'], 4)
self.assertTrue(59.99 < result["working_ratio"] < 60.01) self.assertTrue(59.99 < result["working_ratio"] < 60.01)
def testServerWithShift4(self): def testServerWithShift4(self):
from dream.simulation.Examples.ServerWithShift4 import main from dream.simulation.Examples.ServerWithShift4 import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 2) self.assertEquals(result['parts'], 2)
self.assertTrue(29.99 < result["working_ratio"] < 30.01) self.assertTrue(29.99 < result["working_ratio"] < 30.01)
def testSettingWip1(self): def testSettingWip1(self):
from dream.simulation.Examples.SettingWip1 import main from dream.simulation.Examples.SettingWip1 import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 1) self.assertEquals(result['parts'], 1)
self.assertEquals(result['simulationTime'], 0.25) self.assertEquals(result['simulationTime'], 0.25)
self.assertEquals(result["working_ratio"], 100) self.assertEquals(result["working_ratio"], 100)
def testSettingWip2(self): def testSettingWip2(self):
from dream.simulation.Examples.SettingWip2 import main from dream.simulation.Examples.SettingWip2 import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 2) self.assertEquals(result['parts'], 2)
self.assertEquals(result['simulationTime'], 0.50) self.assertEquals(result['simulationTime'], 0.50)
self.assertEquals(result["working_ratio"], 100) self.assertEquals(result["working_ratio"], 100)
def testSettingWip3(self): def testSettingWip3(self):
from dream.simulation.Examples.SettingWip3 import main from dream.simulation.Examples.SettingWip3 import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 2) self.assertEquals(result['parts'], 2)
self.assertEquals(result['simulationTime'], 0.35) self.assertEquals(result['simulationTime'], 0.35)
self.assertEquals(result["working_ratio"], 100) self.assertEquals(result["working_ratio"], 100)
def testBalancingABuffer(self): def testBalancingABuffer(self):
from dream.simulation.Examples.BalancingABuffer import main from dream.simulation.Examples.BalancingABuffer import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 13) self.assertEquals(result['parts'], 13)
self.assertEquals(result["working_ratio"], 80) self.assertEquals(result["working_ratio"], 80)
def testChangingPredecessors(self): def testChangingPredecessors(self):
from dream.simulation.Examples.ChangingPredecessors import main from dream.simulation.Examples.ChangingPredecessors import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 10) self.assertEquals(result['parts'], 10)
self.assertEquals(result['simulationTime'], 36.0) self.assertEquals(result['simulationTime'], 36.0)
self.assertTrue(83.32 < result["working_ratio"] < 83.34) self.assertTrue(83.32 < result["working_ratio"] < 83.34)
def testSettingWip3(self): def testSettingWip3(self):
from dream.simulation.Examples.SettingWip3 import main from dream.simulation.Examples.SettingWip3 import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 2) self.assertEquals(result['parts'], 2)
self.assertEquals(result['simulationTime'], 0.35) self.assertEquals(result['simulationTime'], 0.35)
self.assertEquals(result["working_ratio"], 100) self.assertEquals(result["working_ratio"], 100)
def testNonStarvingLine(self): def testNonStarvingLine(self):
from dream.simulation.Examples.NonStarvingLine import main from dream.simulation.Examples.NonStarvingLine import main
result = main() result = main(test=1)
self.assertEquals(result['parts'], 9) self.assertEquals(result['parts'], 9)
self.assertEquals(result["working_ratio"], 100) self.assertEquals(result["working_ratio"], 100)
def testNonStarvingLineBatches(self): def testNonStarvingLineBatches(self):
from dream.simulation.Examples.NonStarvingLineBatches import main from dream.simulation.Examples.NonStarvingLineBatches import main
result = main() result = main(test=1)
self.assertEquals(result['batches'], 4) self.assertEquals(result['batches'], 4)
self.assertEquals(result["working_ratio"], 100) self.assertEquals(result["working_ratio"], 100)
\ No newline at end of file
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