Commit 75b1e246 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Sebastien Robin

cleanup in getEntity and removeEntity of jobshop coreobjects

parent 880c1dce
......@@ -40,31 +40,12 @@ class ExitJobShop(Exit):
else:
return False
#gets an entity from the previous station
def getEntity(self):
activeObject=self.getActiveObject()
activeObjectQueue=self.getActiveObjectQueue()
giverObject=self.getGiverObject()
giverObjectQueue=self.getGiverObjectQueue()
activeEntity=giverObjectQueue[0]
name=activeEntity.name #get the name of the entity for the trace
self.totalLifespan+=now()-activeEntity.startTime #Add the entity's lifespan to the total one.
giverObject.removeEntity() #remove the entity from the previous object
self.outputTrace(name)
#activeEntity=Exit.getEntity(self)
#activeEntity.remainingRoute=[]
activeEntity.schedule.append([self.id,now()]) #append the time to schedule so that it can be read in the result
activeEntity.currentStation=self
#get the giver object in a getEntity transaction.
def getGiverObject(self):
from Globals import G
#loop through the objects to see if there is one that holds an Entity requesting for current object
for obj in G.ObjList:
if len(obj.getActiveObjectQueue())>0 and now()!=0:
if len(obj.getActiveObjectQueue())>0 and (obj!=self) and now()!=0:
activeEntity=obj.getActiveObjectQueue()[0]
if activeEntity.remainingRoute[0][0]==self.id:
return obj
......
......@@ -35,11 +35,11 @@ class MachineJobShop(Machine):
#gets an entity from the predecessor that the predecessor index points to
def getEntity(self):
Machine.getEntity(self) #run the default code
avtiveEntity=self.getActiveObjectQueue()[0]
avtiveEntity=Machine.getEntity(self) #run the default code
self.procTime=avtiveEntity.remainingRoute[0][1] #read the processing time from the entity
self.nextStationId=avtiveEntity.remainingRoute[1][0] #read the next station id
avtiveEntity.remainingRoute.pop(0) #remove data from the remaining route of the entity
avtiveEntity.remainingRoute.pop(0) #remove data from the remaining route of the entity
return avtiveEntity
#checks if the machine down or it can dispose the object
def ifCanDisposeOrHaveFailure(self):
......
......@@ -54,28 +54,19 @@ class QueueJobShop(Queue):
return False
#gets an entity from the predecessor that the predecessor index points to
def getEntity(self):
activeObject=self.getActiveObject()
activeObjectQueue=self.getActiveObjectQueue()
giverObject=self.getGiverObject()
giverObjectQueue=self.getGiverObjectQueue()
activeEntity=giverObjectQueue[0]
activeObjectQueue.append(giverObjectQueue[0]) #get the entity from the previous object
#and put it in front of the activeQ
giverObject.removeEntity() #remove the entity from the previous object
def getEntity(self):
activeEntity=Queue.getEntity(self)
activeEntity.remainingRoute[0][0]="" #remove data from the remaining route.
#This is needed so that the Queue will not request again for the Entity
self.outputTrace(activeEntity.name, "got into "+activeObject.objName)
activeEntity.schedule.append([activeObject.id,now()]) #append the time to schedule so that it can be read in the result
return activeEntity
#get the giver object in a getEntity transaction.
def getGiverObject(self):
from Globals import G
#loop through the objects to see if there is one that holds an Entity requesting for current object
for obj in G.ObjList:
if len(obj.getActiveObjectQueue())>0 and now()!=0:
if len(obj.getActiveObjectQueue())>0 and (obj!=self) and now()!=0:
activeEntity=obj.getActiveObjectQueue()[0]
if activeEntity.remainingRoute[0][0]==self.id:
return obj
......
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