Commit 449cfcf2 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

setWIP added also as global method. It would be better for examples. Also...

setWIP added also as global method. It would be better for examples. Also example JobShop1 updated to match new notation
parent bc9dbbef
......@@ -4,6 +4,8 @@ from simulation.QueueJobShop import QueueJobShop
from simulation.ExitJobShop import ExitJobShop
from simulation.Job import Job
from simulation.Globals import G
import simulation.Globals as Globals
#define the objects of the model
Q1=QueueJobShop('Q1','Queue1', capacity=infinity)
......@@ -16,16 +18,9 @@ E=ExitJobShop('E','Exit')
G.ObjList=[M1,M2,M3,Q1,Q2,Q3,E] #add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
Q1.defineRouting(successorList=[M1])
Q2.defineRouting(successorList=[M2])
Q3.defineRouting(successorList=[M3])
M1.defineRouting(predecessorList=[Q1])
M2.defineRouting(predecessorList=[Q2])
M3.defineRouting(predecessorList=[Q3])
#define the Jobs
J=Job('J1','Job1',route=[['Q1',1],['Q3',3],['Q2',2],['E',0]])
J=Job('J1','Job1',route=[['Q1',0],['M1',1],['Q3',0],['M3',3],['Q2',0],['M2',2],['E',0]])
G.EntityList=[J]
initialize() #initialize the simulation (SimPy method)
......@@ -35,10 +30,7 @@ for object in G.ObjList:
J.initialize()
#set the WIP
Q1.getActiveObjectQueue().append(J) #place the Job at 'Q1'
J.remainingRoute[0][0]='' #remove data from the remaining route since it is already added in Q1.
#this is to make sure that the Job will not get again into Queue1 while it waits in Queue1
J.schedule.append(['Q1',now()]) #add the data in the schedule that the Job entered Q1 at time=0
Globals.setWIP(G.EntityList)
#activate all the objects
for object in G.ObjList:
......@@ -53,9 +45,7 @@ for record in J.schedule:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name=None
for obj in G.ObjList:
if obj.id==record[0]:
if obj is record[0]:
name=obj.objName
print J.name, "got into", name, "at", record[1]
\ No newline at end of file
......@@ -32,6 +32,7 @@ from Repairman import Repairman
import xlwt
import xlrd
from random import Random, expovariate, gammavariate, normalvariate
from SimPy.Simulation import now
# globals
class G:
......@@ -74,4 +75,15 @@ def findObjectById(id):
for obj in G.ObjList:
if obj.id==id:
return obj
return None
\ No newline at end of file
return None
def setWIP(entityList):
for entity in entityList:
if entity.type=='Job':
objectId=entity.currentStation # get the id of the object where the entity currently seats
object=findObjectById(entity.remainingRoute[0][0]) # find the object in the 'G.ObjList
object.getActiveObjectQueue().append(entity) # append the entity to its Queue
object.receiver=findObjectById(entity.remainingRoute[1][0])
entity.remainingRoute.pop(0) # remove data from the remaining route.
entity.schedule.append([object,now()]) #append the time to schedule so that it can be read in the result
entity.currentStation=object # update the current station of the entity
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