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

examples editted not to print in test mode

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