Commit 880c1dce authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Sebastien Robin

more cleanup in getEntity and removeEntity of coreobjects

parent 40253aa2
......@@ -185,7 +185,8 @@ class Assembly(CoreObject):
def removeEntity(self):
activeEntity=CoreObject.removeEntity(self) #run the default method
self.outputTrace(activeEntity.name, "releases "+ self.objName) #output trace
self.waitToDispose=False #the object does not wait to dispose now
self.waitToDispose=False
return activeEntity #the object does not wait to dispose now
#gets an entity from the predecessor
#it may handle both Parts and Frames
......@@ -208,6 +209,7 @@ class Assembly(CoreObject):
self.nameLastEntityEntered=activeEntity.name
self.timeLastEntityEntered=now()
activeEntity.currentStation=self
return activeEntity
#actions to be taken after the simulation ends
def postProcessing(self, MaxSimtime=None):
......
......@@ -204,22 +204,16 @@ class Conveyer(CoreObject):
return self.canAccept(self) and self.getGiverObject().haveToDispose(self)
#gets an entity from the predecessor
def getEntity(self):
activeObjectQueue=self.getActiveObjectQueue()
giverObject=self.getGiverObject()
giverObjectQueue=self.getGiverObjectQueue()
giverObject.sortEntities() #sort the Entities of the giver according to the scheduling rule if applied
activeEntity=giverObjectQueue[0]
activeObjectQueue.append(activeEntity) #get the entity from the predecessor
def getEntity(self):
activeEntity=CoreObject.getEntity(self)
self.position.append(0) #the entity is placed in the start of the conveyer
giverObject.removeEntity() #remove the entity from the previous object
self.outputTrace(activeEntity.name, "got into "+ self.objName)
activeEntity.currentStation=self
self.outputTrace(activeEntity.name, "got into "+ self.objName) #output trace
#check if the conveyer became full to start counting blockage
if self.isFull():
self.timeBlockageStarted=now()
self.wasFull=True
return activeEntity
#removes an entity from the Conveyer
def removeEntity(self):
......@@ -237,6 +231,7 @@ class Conveyer(CoreObject):
self.timeToBecomeAvailable=((self.position[-1]+self.currentRequestedLength)/float(self.speed))/60
self.conveyerMover.timeToWait=self.timeToBecomeAvailable
self.call=True
return activeEntity
#checks if the Conveyer can dispose an entity to the following object
def haveToDispose(self, callerObject=None):
......
......@@ -165,25 +165,20 @@ class Dismantle(CoreObject):
#gets a frame from the predecessor that the predecessor index points to
def getEntity(self):
activeEntity=CoreObject.getEntity(self) #run the default method
activeObjectQueue=self.getActiveObjectQueue()
giverObject=self.getGiverObject()
giverObject.sortEntities() #sort the Entities of the giver according to the scheduling rule if applied
giverObjectQueue=self.getGiverObjectQueue()
activeEntity=giverObjectQueue[0]
activeObjectQueue.append(activeEntity) #get the frame from the predecessor
giverObject.removeEntity()
activeEntity.currentStation=self
#append also the parts in the res so that they can be popped
#get also the parts of the frame so that they can be popped
for part in activeEntity.getFrameQueue():
activeObjectQueue.append(part)
part.currentStation=self
activeEntity.getFrameQueue=[] #empty the frame
#move the frame to the end of the internal queue since we want the frame to be disposed first
activeObjectQueue.append(activeEntity)
activeObjectQueue.pop(0)
self.outputTrace(activeEntity.name, "got into "+ self.objName)
return activeEntity
#removes an entity from the Dismantle
def removeEntity(self):
......@@ -196,6 +191,7 @@ class Dismantle(CoreObject):
else:
if(len(activeObjectQueue)==1):
self.waitToDisposePart=False
return activeEntity
#outputs message to the trace.xls. Format is (Simulation Time | Entity or Frame Name | message)
def outputTrace(self, name, message):
......
......@@ -295,11 +295,12 @@ class Machine(CoreObject):
def removeEntity(self):
activeObject=self.getActiveObject()
activeObject.outputTrace("releases "+activeObject.objName) # output to trace that the Entity was released from the currentObject
CoreObject.removeEntity(self) #run the default method
activeEntity=CoreObject.removeEntity(self) #run the default method
activeObject.timeLastEntityLeft=now() # set the time that the last Entity was removed from this object
activeObject.waitToDispose=False # update the waitToDispose flag
activeObject.downTimeInTryingToReleaseCurrentEntity=0 # re-initialize the timer downTimeInTryingToReleaseCurrentEntity
return activeEntity
# =======================================================================
# checks if the Machine can dispose an entity to the following object
# =======================================================================
......
......@@ -168,6 +168,7 @@ class Queue(CoreObject):
activeObject=self.getActiveObject()
activeEntity=CoreObject.removeEntity(self) #run the default method
activeObject.outputTrace(activeEntity.name, "releases "+activeObject.objName) #output trace
return activeEntity
#checks if the Queue can accept an entity and there is an entity in some predecessor waiting for it
#also updates the predecessorIndex to the one that is to be taken
......@@ -205,7 +206,8 @@ class Queue(CoreObject):
activeEntity=CoreObject.getEntity(self) #run the default behavior
self.outputTrace(activeEntity.name, "got into "+self.objName)
return activeEntity
#sorts the Entities of the Queue according to the scheduling rule
def sortEntities(self):
#if we have sorting according to multiple criteria we have to call the sorter many times
......
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