예제 #1
0
def main():
    initialize()                        #initialize the simulation (SimPy method)
            
    #initialize all the objects    
    for object in G.ObjList:
        object.initialize()
    J.initialize()
    
    #set the WIP
    Globals.setWIP(G.EntityList)
        
    #activate all the objects 
    for object in G.ObjList:
        activate(object, object.run())
    
    simulate(until=infinity)    #run the simulation until there are no more events
    
    G.maxSimTime=E.timeLastEntityLeft   #calculate the maxSimTime as the time that the last Job left
    
    #loop in the schedule to print the results
    schedule=[]
    for record in J.schedule:
        schedule.append([record[0].objName,record[1]])
        print J.name, "got into", record[0].objName, "at", record[1] 
    ExcelHandler.outputTrace('TRACE')
    return schedule
예제 #2
0
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
예제 #3
0
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
예제 #4
0
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
예제 #5
0
def main():
    # add all the objects in a list
    objectList=[Q,M,E,P1]  
    # 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')

    #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}
예제 #6
0
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')
예제 #7
0
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')
예제 #8
0
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"
    print "the total working ratio of the Machine is", working_ratio, "%"
    ExcelHandler.outputTrace('ChangingPredecessors')
예제 #9
0
def main(test=0):
    # add all the objects in a list
    objectList=[Q,M,E,P1]  
    # 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')
예제 #10
0
Tr1=MilkTransport('Tr1','Tr1')
Tr2=MilkTransport('Tr2','Tr2')
Tr3=MilkTransport('Tr3','Tr3')

E=ExitJobShop('E','Exit')

route1=[{"stationIdsList": ["T1"]},
         {"stationIdsList": ["Tr1"],"processingTime":{'Fixed':{'mean':0.17341}}},
         {"stationIdsList": ["T2"]},
         {"stationIdsList": ["Tr2"],"processingTime":{'Fixed':{'mean':0}},'volume':1000},
         {"stationIdsList": ["E"]}]

route2=[{"stationIdsList": ["T3"]},
         {"stationIdsList": ["Tr3"],"processingTime":{'Fixed':{'mean':1.11111}}},
         {"stationIdsList": ["T2"]},
         {"stationIdsList": ["Tr2"],"processingTime":{'Fixed':{'mean':0}},'volume':1000},
         {"stationIdsList": ["E"]}]

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