naming conventions changed, minor clean-up

parent 7096353c
...@@ -160,7 +160,7 @@ class ConditionalBuffer(QueueManagedJob): ...@@ -160,7 +160,7 @@ class ConditionalBuffer(QueueManagedJob):
#=========================================================================== #===========================================================================
# checks whether the entity can proceed to a successor object # checks whether the entity can proceed to a successor object
#=========================================================================== #===========================================================================
def canEntityProceed(self, entity=None): def canDeliver(self, entity=None):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity activeEntity=entity
...@@ -175,7 +175,7 @@ class ConditionalBuffer(QueueManagedJob): ...@@ -175,7 +175,7 @@ class ConditionalBuffer(QueueManagedJob):
mayProceed=False mayProceed=False
# for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity # for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity
for nextObject in [object for object in activeObject.next if object.canAcceptEntity(activeEntity)]: for nextObject in [object for object in activeObject.next if object.canAcceptEntity(activeEntity)]:
activeEntity.canProceed=True activeEntity.proceed=True
activeEntity.candidateReceivers.append(nextObject) activeEntity.candidateReceivers.append(nextObject)
mayProceed=True mayProceed=True
return mayProceed return mayProceed
\ No newline at end of file
...@@ -64,7 +64,7 @@ class Entity(object): ...@@ -64,7 +64,7 @@ class Entity(object):
self.family='Entity' self.family='Entity'
# variables to be used by OperatorRouter # variables to be used by OperatorRouter
self.canProceed=False # boolean that is used to check weather the entity can proceed to the candidateReceiver self.proceed=False # boolean that is used to check weather the entity can proceed to the candidateReceiver
self.candidateReceivers=[] # list of candidateReceivers of the entity (those stations that can receive the entity self.candidateReceivers=[] # list of candidateReceivers of the entity (those stations that can receive the entity
self.candidateReceiver=None # the station that is finaly chosen to receive the entity self.candidateReceiver=None # the station that is finaly chosen to receive the entity
...@@ -72,6 +72,13 @@ class Entity(object): ...@@ -72,6 +72,13 @@ class Entity(object):
self.receiver=None self.receiver=None
self.timeOfAssignement=0 self.timeOfAssignement=0
#===========================================================================
# check if the entity can proceed to an operated machine, for use by Router
#===========================================================================
def canProceed(self):
activeObject=self.currentStation
return activeObject.canDeliver(self)
#=========================================================================== #===========================================================================
# method that finds a receiver for a candidate entity # method that finds a receiver for a candidate entity
#=========================================================================== #===========================================================================
......
...@@ -765,7 +765,7 @@ class Machine(CoreObject): ...@@ -765,7 +765,7 @@ class Machine(CoreObject):
#=========================================================================== #===========================================================================
# checks whether the entity can proceed to a successor object # checks whether the entity can proceed to a successor object
#=========================================================================== #===========================================================================
def canEntityProceed(self, entity=None): def canDeliver(self, entity=None):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity activeEntity=entity
...@@ -774,7 +774,7 @@ class Machine(CoreObject): ...@@ -774,7 +774,7 @@ class Machine(CoreObject):
router = G.Router router = G.Router
# if the entity is in a machines who's broker waits for operator then # if the entity is in a machines who's broker waits for operator then
if activeObject in router.pendingMachines: if activeObject in router.pendingMachines:
activeEntity.canProceed=True activeEntity.proceed=True
activeEntity.candidateReceivers.append(activeObject) activeEntity.candidateReceivers.append(activeObject)
return True return True
return False return False
......
...@@ -184,7 +184,7 @@ class MouldAssemblyBuffer(QueueManagedJob): ...@@ -184,7 +184,7 @@ class MouldAssemblyBuffer(QueueManagedJob):
#=========================================================================== #===========================================================================
# checks whether the entity can proceed to a successor object # checks whether the entity can proceed to a successor object
#=========================================================================== #===========================================================================
def canEntityProceed(self, entity=None): def canDeliver(self, entity=None):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity activeEntity=entity
...@@ -195,7 +195,7 @@ class MouldAssemblyBuffer(QueueManagedJob): ...@@ -195,7 +195,7 @@ class MouldAssemblyBuffer(QueueManagedJob):
mayProceed=False mayProceed=False
# for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity # for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity
for nextObject in [object for object in activeObject.next if object.canAcceptEntity(activeEntity)]: for nextObject in [object for object in activeObject.next if object.canAcceptEntity(activeEntity)]:
activeEntity.canProceed=True activeEntity.proceed=True
activeEntity.candidateReceivers.append(nextObject) activeEntity.candidateReceivers.append(nextObject)
mayProceed=True mayProceed=True
return mayProceed return mayProceed
...@@ -235,7 +235,7 @@ class Router(ObjectInterruption): ...@@ -235,7 +235,7 @@ class Router(ObjectInterruption):
operator.candidateStation=None operator.candidateStation=None
operator.candidateEntity=None operator.candidateEntity=None
for entity in G.pendingEntities: for entity in G.pendingEntities:
entity.canProceed=False entity.proceed=False
entity.candidateReceivers=[] entity.candidateReceivers=[]
entity.candidateReceiver=None entity.candidateReceiver=None
del self.candidateOperators[:] del self.candidateOperators[:]
...@@ -424,8 +424,7 @@ class Router(ObjectInterruption): ...@@ -424,8 +424,7 @@ class Router(ObjectInterruption):
# if the entity is ready to move to a machine and its manager is available # if the entity is ready to move to a machine and its manager is available
if entity.manager.checkIfResourceIsAvailable(): if entity.manager.checkIfResourceIsAvailable():
# check whether the entity canProceed and update the its candidateReceivers # check whether the entity canProceed and update the its candidateReceivers
# if entity.canEntityProceed()\ if entity.canProceed()\
if entity.currentStation.canEntityProceed(entity)\
and not entity.manager in self.candidateOperators: and not entity.manager in self.candidateOperators:
self.candidateOperators.append(entity.manager) self.candidateOperators.append(entity.manager)
# TODO: check if preemption can be implemented for the managed case # TODO: check if preemption can be implemented for the managed case
......
...@@ -201,7 +201,7 @@ class Queue(CoreObject): ...@@ -201,7 +201,7 @@ class Queue(CoreObject):
#=========================================================================== #===========================================================================
# checks whether the entity can proceed to a successor object # checks whether the entity can proceed to a successor object
#=========================================================================== #===========================================================================
def canEntityProceed(self, entity=None): def canDeliver(self, entity=None):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity activeEntity=entity
...@@ -209,7 +209,7 @@ class Queue(CoreObject): ...@@ -209,7 +209,7 @@ class Queue(CoreObject):
mayProceed=False mayProceed=False
# for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity # for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity
for nextObject in [object for object in activeObject.next if object.canAcceptEntity(activeEntity)]: for nextObject in [object for object in activeObject.next if object.canAcceptEntity(activeEntity)]:
activeEntity.canProceed=True activeEntity.proceed=True
activeEntity.candidateReceivers.append(nextObject) activeEntity.candidateReceivers.append(nextObject)
mayProceed=True mayProceed=True
return mayProceed return mayProceed
......
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