CoreObject clean-up

parent e8cef93c
...@@ -162,8 +162,7 @@ class ConditionalBuffer(QueueManagedJob): ...@@ -162,8 +162,7 @@ class ConditionalBuffer(QueueManagedJob):
#=========================================================================== #===========================================================================
def canEntityProceed(self, entity=None): def canEntityProceed(self, entity=None):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=activeObject.getActiveObjectQueue() assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
assert entity in activeObjectQueue, entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity activeEntity=entity
# for entities of type OrderComponent, if they reside at a conditionalBuffer, # for entities of type OrderComponent, if they reside at a conditionalBuffer,
......
...@@ -587,45 +587,6 @@ class CoreObject(Process): ...@@ -587,45 +587,6 @@ class CoreObject(Process):
# ======================================================================= # =======================================================================
def getReceiverObjectQueue(self): def getReceiverObjectQueue(self):
return self.getReceiverObject().getActiveObjectQueue() return self.getReceiverObject().getActiveObjectQueue()
# # =======================================================================
# # get the giver object queue in a getEntity transaction.
# # =======================================================================
# def updateGiverObject(self):
# activeObject=self
# # dummy variables that help prioritize the objects requesting to give objects to the Machine (activeObject)
# maxTimeWaiting=0 # dummy variable counting the time a predecessor is blocked
# giver=None
#
# # loop through the possible givers to see which have to dispose and which is the one blocked for longer
# for object in activeObject.previous:
# if(object.haveToDispose(activeObject) and object.receiver==self):
# if(object.downTimeInTryingToReleaseCurrentEntity>0):# and the predecessor has been down while trying to give away the Entity
# timeWaiting=now()-object.timeLastFailureEnded # the timeWaiting dummy variable counts the time end of the last failure of the giver object
# else:
# timeWaiting=now()-object.timeLastEntityEnded # in any other case, it holds the time since the end of the Entity processing
#
# #if more than one predecessor have to dispose take the part from the one that is blocked longer
# if(timeWaiting>=maxTimeWaiting):
# giver=object # the object to deliver the Entity to the activeObject is set to the ith member of the previous list
# maxTimeWaiting=timeWaiting
# return giver
# # =======================================================================
# # get the receiver object
# # =======================================================================
# def updateReceiverObject(self):
# activeObject=self
# # dummy variables that help prioritize the objects requesting to give objects to the Machine (activeObject)
# maxTimeWaiting=0 # dummy variable counting the time a successor is waiting
# receiver=None
# for object in activeObject.next:
# if(object.canAccept(activeObject)): # if a successor can accept an object
# timeWaiting=now()-object.timeLastEntityLeft # the time it has been waiting is updated and stored in dummy variable timeWaiting
# if(timeWaiting>maxTimeWaiting or maxTimeWaiting==0):# if the timeWaiting is the maximum among the ones of the successors
# maxTimeWaiting=timeWaiting
# receiver=object # set the receiver as the longest waiting possible receiver
# return receiver
# ======================================================================= # =======================================================================
# calculates the processing time # calculates the processing time
...@@ -699,13 +660,13 @@ class CoreObject(Process): ...@@ -699,13 +660,13 @@ class CoreObject(Process):
def activeQueueIsEmpty(self): def activeQueueIsEmpty(self):
return len(self.Res.activeQ)==0 return len(self.Res.activeQ)==0
# ======================================================================= # # =======================================================================
# checks if the object is ready to receive an Entity # # checks if the object is ready to receive an Entity
# ======================================================================= # # =======================================================================
def isReadyToGet(self): # def isReadyToGet(self):
return True # set to true since this control was not needed until now. # return True # set to true since this control was not needed until now.
# to return canAcceptAndIsRequested() would be more logical, but also computationally expensive # # to return canAcceptAndIsRequested() would be more logical, but also computationally expensive
#return self.canAcceptAndIsRequested() # #return self.canAcceptAndIsRequested()
# ======================================================================= # =======================================================================
# actions to be carried out when the processing of an Entity ends # actions to be carried out when the processing of an Entity ends
......
...@@ -803,8 +803,7 @@ class Machine(CoreObject): ...@@ -803,8 +803,7 @@ class Machine(CoreObject):
#=========================================================================== #===========================================================================
def canEntityProceed(self, entity=None): def canEntityProceed(self, entity=None):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=activeObject.getActiveObjectQueue() assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
assert entity in activeObjectQueue, entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity activeEntity=entity
from Globals import G from Globals import G
......
...@@ -186,8 +186,7 @@ class MouldAssemblyBuffer(QueueManagedJob): ...@@ -186,8 +186,7 @@ class MouldAssemblyBuffer(QueueManagedJob):
#=========================================================================== #===========================================================================
def canEntityProceed(self, entity=None): def canEntityProceed(self, entity=None):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=activeObject.getActiveObjectQueue() assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
assert entity in activeObjectQueue, entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity activeEntity=entity
# unassembled components of a mould must wait at a MouldAssemblyBuffer till the componentsReadyForAssembly flag is raised # unassembled components of a mould must wait at a MouldAssemblyBuffer till the componentsReadyForAssembly flag is raised
......
...@@ -203,8 +203,7 @@ class Queue(CoreObject): ...@@ -203,8 +203,7 @@ class Queue(CoreObject):
#=========================================================================== #===========================================================================
def canEntityProceed(self, entity=None): def canEntityProceed(self, entity=None):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=activeObject.getActiveObjectQueue() assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
assert entity in activeObjectQueue, entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity activeEntity=entity
mayProceed=False mayProceed=False
......
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