def main(test=0): # add all the objects in a list objectList = [S, Q, M1, M2, 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_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")) print(("the working ratio of", M1.objName, "is", working_ratio_M1, "%")) print(("the working ratio of", M2.objName, "is", working_ratio_M2, "%"))
def main(test=0): # add all the objects in a list objectList = [S, M1, M2, E, Q, R, F1, F2] # set the length of the experiment maxSimTime = 1440.0 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime) # 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")) print(("the blockage ratio of", M1.objName, "is", blockage_ratio, "%")) print(("the working ratio of", R.objName, "is", working_ratio, "%"))
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["station"].objName, record["entranceTime"]]) return returnSchedule # print the results for job in [J1, J2, J3]: for record in job.schedule: print(( job.name, "got into", record["station"].objName, "at", record["entranceTime"], )) print(("-" * 30))
def main(test=0): # add all the objects in a list objectList = [Q, M, E, P1, P2] # 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 / 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", )) print(("the total working ratio of the Machine is", working_ratio, "%")) ExcelHandler.outputTrace("Wip1")
def main(test=0): # add all the objects in a list objectList = [S, M1, M2, E, Q, R, F1, F2] # set the length of the experiment maxSimTime = 1440.0 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime) # 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, "%")) # create a graph object from manpy.KnowledgeExtraction.Plots import Graphs graph = Graphs() # create the pie graph.Pie([working_ratio, waiting_ratio], "repairmanPie.jpg")
def main(test=0): # add all the objects in a list objectList = [S, Q, BD, 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 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))
def main(test=0): # call the runSimulation giving the objects and the length of the experiment runSimulation( objectList=[QB, Q1, M1, Q2, M2, Q3, M3, QA, E, P1, P2, P3, P4, P5, P6, MA], maxSimTime=float("inf"), trace="Yes", ) # output the trace of the simulation ExcelHandler.outputTrace("CompoundMachine") if test: return G.maxSimTime
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, trace="Yes") # calculate metrics working_ratio_M1 = (M1.totalWorkingTime / maxSimTime) * 100 blockage_ratio_M1 = (M1.totalBlockageTime / 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)) 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")
def main(test=0): # loop through the scheduling rules for schedulingRule in ["EDD", "RPC"]: totalDelay = 0 # set the scheduline rule of Q1 Q1.schedulingRule = schedulingRule # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList=[M1, M2, M3, Q1, Q2, Q3, E, J1, J2], maxSimTime=float("inf")) # loop through the moulds and if they are delayed add to the total delay for job in [J1, J2]: totalDelay += max( [job.schedule[-1]["entranceTime"] - job.dueDate, 0]) if test: return totalDelay # print the total delay print(("running with", schedulingRule, "total delay is", totalDelay))
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 # 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")) print(("the working ratio of", A.objName, "is", working_ratio, "%"))
def main(test=0): # add all the objects in a list objectList = [S, Q, 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")) print(("the total working ratio of the Machine is", working_ratio, "%"))
def main(): # add all the objects in a list objectList = [M1, M2, M3, Q1, Q2, Q3, E, J] # 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") # loop in the schedule to print the results schedule = [] for record in J.schedule: schedule.append([record["station"].objName, record["entranceTime"]]) print(( J.name, "got into", record["station"].objName, "at", record["entranceTime"], )) ExcelHandler.outputTrace("TRACE") return schedule
def main(): # add all the objects in a list objectList = [S, M1, M2, E, Q, R, F1, F2] # set the length of the experiment maxSimTime = 1440.0 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime, numberOfReplications=10, seed=1) print("The exit of each replication is:") print((E.Exits)) # calculate confidence interval using the Knowledge Extraction tool from manpy.KnowledgeExtraction.ConfidenceIntervals import Intervals from manpy.KnowledgeExtraction.StatisticalMeasures import BasicStatisticalMeasures BSM = BasicStatisticalMeasures() lb, ub = Intervals().ConfidIntervals(E.Exits, 0.95) print("the 95% confidence interval for the throughput is:") print(("lower bound:", lb)) print(("mean:", BSM.mean(E.Exits))) print(("upper bound:", ub))
def main(test=0): # add all the objects in a list objectList = [NS, M1, M2, M3, Q2, Q3, E] # set the length of the experiment maxSimTime = 480 solutionList = [] for i in range(1, 10): Q2.capacity = i Q3.capacity = 10 - i # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime, numberOfReplications=10) # return results for the test if test: return {"parts": E.numOfExits} solutionList.append( { "Q2": Q2.capacity, "Q3": Q3.capacity, "throughput": sum(E.Exits) / float(len(E.Exits)), } ) E.Exits = [] solutionList.sort(key=lambda x: x.get("throughput", 0), reverse=True) print( ( "the best allocation is for Q2", solutionList[0]["Q2"], "units and Q3", solutionList[0]["Q2"], "units, with a predicted throughput of", solutionList[0]["throughput"], ) )
] MPList = [] for i in range(173): MP = MilkPack( "MT_A" + str(i), "MT_A" + str(i), route=list(route1), liters=5, fat=3.8, productId=1, ) MPList.append(MP) for i in range(27): MP = MilkPack( "MT_B" + str(i), "MT_B" + str(i), route=route2, currentStation=T3, liters=5, fat=0.1, productId=1, ) MPList.append(MP) runSimulation([T1, T2, T3, Tr1, Tr2, Tr3, E] + MPList, 1000, trace="Yes") ExcelHandler.outputTrace("MilkPlant") print((1))
MPList.append(MP) for i in range(int(135 / float(milkUnit))): MP = MilkPack( "MT_B" + str(i), "MT_B" + str(i), route=route2 + commonRoute, liters=milkUnit, fat=0.1 * milkUnit, productId="Product X", ) MPList.append(MP) runSimulation( [T1, T2, T3, TBM2, TAM2, TBM3, TAM3, Tr1, Tr2, Tr3, Tr4, Tr5, M2, M3, E] + MPList, 1000, trace="Yes", ) ExcelHandler.outputTrace("MilkPlant2") for productId in E.finishedProductDict: volume = E.finishedProductDict[productId]["volume"] totalFat = E.finishedProductDict[productId]["totalFat"] exitTime = E.finishedProductDict[productId]["exitTime"] fat = totalFat / float(volume) print( ( "from", productId, volume, "liters were produced of",
# the transition probabilities for machines M1.p = 0.01 M1.g = 0.01 M1.r = 0.1 M1.f = 0.2 M2.p = 0.01 M2.g = 0.01 M2.r = 0.1 M2.f = 0.2 M3.p = 0.01 M3.g = 0.01 M3.r = 0.1 M3.f = 0.2 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime, numberOfReplications=20, trace="No") # print the results PRt = sum(E.Exits) / float(len(E.Exits)) PRg = sum(E.GoodExits) / float(len(E.GoodExits)) # B123ABF=sum(B123.BufferLevel)/float(len(B123.BufferLevel)) print((E.Exits)) print((E.GoodExits)) print((G.AverageWIP)) print(("PRt=", PRt / float(maxSimTime))) print(("PRg=", PRg / float(maxSimTime))) # print 'B123 average buffer level=',B123ABF for M in [M1, M2, M3]: GE = sum(M.GoodExits) / float(len(M.GoodExits)) print(("PRg" + M.id, "=", GE / float(maxSimTime)))