Commit 8d0d0417 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

isInRoute method renamed; isInRouteOf

parent b87e59f0
...@@ -693,7 +693,7 @@ class CoreObject(ManPyObject): ...@@ -693,7 +693,7 @@ class CoreObject(ManPyObject):
#=========================================================================== #===========================================================================
# method used to check whether the station is a successor of the caller # method used to check whether the station is a successor of the caller
#=========================================================================== #===========================================================================
def isInRoute(self, callerObject=None): def isInRouteOf(self, callerObject=None):
thecaller=callerObject thecaller=callerObject
# if the caller is not defined then return True. We are only interested in checking whether # if the caller is not defined then return True. We are only interested in checking whether
# the station can accept whatever entity from whichever giver # the station can accept whatever entity from whichever giver
......
...@@ -47,7 +47,7 @@ class ExitJobShop(Exit): ...@@ -47,7 +47,7 @@ class ExitJobShop(Exit):
# method used to check whether the station is in the entity-to-be-received route # method used to check whether the station is in the entity-to-be-received route
# TODO: consider giving the activeEntity as attribute # TODO: consider giving the activeEntity as attribute
#=========================================================================== #===========================================================================
def isInRoute(self, callerObject=None): def isInRouteOf(self, callerObject=None):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=activeObject.getActiveObjectQueue() activeObjectQueue=activeObject.getActiveObjectQueue()
thecaller=callerObject thecaller=callerObject
......
...@@ -979,14 +979,14 @@ class Machine(CoreObject): ...@@ -979,14 +979,14 @@ class Machine(CoreObject):
return self.operatorPool.checkIfResourceIsAvailable()\ return self.operatorPool.checkIfResourceIsAvailable()\
and self.checkIfMachineIsUp()\ and self.checkIfMachineIsUp()\
and len(activeObjectQueue)<self.capacity\ and len(activeObjectQueue)<self.capacity\
and self.isInRoute(thecaller)\ and self.isInRouteOf(thecaller)\
and not self.entryIsAssignedTo() and not self.entryIsAssignedTo()
else: else:
# the operator doesn't have to be present for the loading of the machine as the load operation # the operator doesn't have to be present for the loading of the machine as the load operation
# is not assigned to operators # is not assigned to operators
return self.checkIfMachineIsUp()\ return self.checkIfMachineIsUp()\
and len(activeObjectQueue)<self.capacity\ and len(activeObjectQueue)<self.capacity\
and self.isInRoute(thecaller)\ and self.isInRouteOf(thecaller)\
and not self.entryIsAssignedTo() and not self.entryIsAssignedTo()
# ======================================================================= # =======================================================================
...@@ -1093,7 +1093,7 @@ class Machine(CoreObject): ...@@ -1093,7 +1093,7 @@ class Machine(CoreObject):
thecaller=callerObject thecaller=callerObject
return len(activeObjectQueue)>0\ return len(activeObjectQueue)>0\
and self.waitToDispose\ and self.waitToDispose\
and thecaller.isInRoute(self)\ and thecaller.isInRouteOf(self)\
and (self.canDeliverOnInterruption and (self.canDeliverOnInterruption
or self.timeLastEntityEnded==self.env.now or self.timeLastEntityEnded==self.env.now
or self.checkIfActive()) or self.checkIfActive())
......
...@@ -117,18 +117,18 @@ class MachineJobShop(Machine): ...@@ -117,18 +117,18 @@ class MachineJobShop(Machine):
return self.operatorPool.checkIfResourceIsAvailable()\ return self.operatorPool.checkIfResourceIsAvailable()\
and len(activeObjectQueue)<self.capacity\ and len(activeObjectQueue)<self.capacity\
and self.checkIfMachineIsUp()\ and self.checkIfMachineIsUp()\
and self.isInRoute(thecaller)\ and self.isInRouteOf(thecaller)\
and not self.entryIsAssignedTo() and not self.entryIsAssignedTo()
else: else:
return len(activeObjectQueue)<self.capacity\ return len(activeObjectQueue)<self.capacity\
and self.checkIfMachineIsUp()\ and self.checkIfMachineIsUp()\
and self.isInRoute(thecaller)\ and self.isInRouteOf(thecaller)\
and not self.entryIsAssignedTo() and not self.entryIsAssignedTo()
#=========================================================================== #===========================================================================
# method used to check whether the station is in the entity-to-be-received route # method used to check whether the station is in the entity-to-be-received route
#=========================================================================== #===========================================================================
def isInRoute(self, callerObject=None): def isInRouteOf(self, callerObject=None):
activeObjectQueue=self.Res.users activeObjectQueue=self.Res.users
thecaller=callerObject thecaller=callerObject
# if the caller is not defined then return True. We are only interested in checking whether # if the caller is not defined then return True. We are only interested in checking whether
...@@ -161,7 +161,7 @@ class MachineJobShop(Machine): ...@@ -161,7 +161,7 @@ class MachineJobShop(Machine):
return len(activeObjectQueue)>0\ return len(activeObjectQueue)>0\
and self.waitToDispose\ and self.waitToDispose\
and self.checkIfActive()\ and self.checkIfActive()\
and thecaller.isInRoute(self) and thecaller.isInRouteOf(self)
# ======================================================================= # =======================================================================
# method to execute preemption # method to execute preemption
...@@ -205,7 +205,7 @@ class MachineJobShop(Machine): ...@@ -205,7 +205,7 @@ class MachineJobShop(Machine):
def canAcceptAndIsRequested(self,callerObject): def canAcceptAndIsRequested(self,callerObject):
giverObject=callerObject giverObject=callerObject
assert giverObject, 'there must be a caller for canAcceptAndIsRequested' assert giverObject, 'there must be a caller for canAcceptAndIsRequested'
if self.isInRoute(giverObject): if self.isInRouteOf(giverObject):
if Machine.canAcceptAndIsRequested(self,giverObject): if Machine.canAcceptAndIsRequested(self,giverObject):
self.readLoadTime(giverObject) self.readLoadTime(giverObject)
return True return True
......
...@@ -171,15 +171,15 @@ class MouldAssemblyBufferManaged(QueueManagedJob): ...@@ -171,15 +171,15 @@ class MouldAssemblyBufferManaged(QueueManagedJob):
# TODO: the activeEntity is already checked for the flag componentsReadyForAssembly # TODO: the activeEntity is already checked for the flag componentsReadyForAssembly
if len(thecaller.getActiveObjectQueue())==0: if len(thecaller.getActiveObjectQueue())==0:
if activeEntity.type=='Mould': if activeEntity.type=='Mould':
return thecaller.isInRoute(activeObject) return thecaller.isInRouteOf(activeObject)
else: else:
return thecaller.isInRoute(activeObject)\ return thecaller.isInRouteOf(activeObject)\
and activeEntity.order.componentsReadyForAssembly and activeEntity.order.componentsReadyForAssembly
# otherwise, check additionally if the receiver holds orderComponents of the same order # otherwise, check additionally if the receiver holds orderComponents of the same order
# TODO: should revise, this check may be redundant, as the receiver (assembler must be empty in order to start receiving # TODO: should revise, this check may be redundant, as the receiver (assembler must be empty in order to start receiving
# It is therefore needed that the control is performed by the assembler's getEntity() # It is therefore needed that the control is performed by the assembler's getEntity()
else: else:
return thecaller.isInRoute(activeObject)\ return thecaller.isInRouteOf(activeObject)\
and thecaller.getActiveObjectQueue()[0].order is activeEntity.order\ and thecaller.getActiveObjectQueue()[0].order is activeEntity.order\
and activeEntity.order.componentsReadyForAssembly and activeEntity.order.componentsReadyForAssembly
......
...@@ -381,7 +381,7 @@ class Router(ObjectInterruption): ...@@ -381,7 +381,7 @@ class Router(ObjectInterruption):
operator.candidateEntities.append(station.currentEntity) operator.candidateEntities.append(station.currentEntity)
else: else:
for predecessor in station.previous: for predecessor in station.previous:
if predecessor in self.pendingQueues and not station in occupiedStations and station.isInRoute(predecessor): if predecessor in self.pendingQueues and not station in occupiedStations and station.isInRouteOf(predecessor):
if predecessor.getActiveObjectQueue()[0] in self.pending\ if predecessor.getActiveObjectQueue()[0] in self.pending\
and not predecessor.getActiveObjectQueue()[0] in occupiedEntities: and not predecessor.getActiveObjectQueue()[0] in occupiedEntities:
operator.candidateEntities.append(predecessor.getActiveObjectQueue()[0]) operator.candidateEntities.append(predecessor.getActiveObjectQueue()[0])
......
...@@ -157,13 +157,13 @@ class OrderDecomposition(CoreObject): ...@@ -157,13 +157,13 @@ class OrderDecomposition(CoreObject):
return True return True
#return True if the OrderDecomposition in the state of disposing and the caller is the receiver #return True if the OrderDecomposition in the state of disposing and the caller is the receiver
return self.Up and thecaller.isInRoute(activeObject) return self.Up and thecaller.isInRouteOf(activeObject)
#=========================================================================== #===========================================================================
# method used to check whether the station is in the entity-to-be-received route # method used to check whether the station is in the entity-to-be-received route
# TODO: consider giving the activeEntity as attribute # TODO: consider giving the activeEntity as attribute
#=========================================================================== #===========================================================================
def isInRoute(self, callerObject=None): def isInRouteOf(self, callerObject=None):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=activeObject.getActiveObjectQueue() activeObjectQueue=activeObject.getActiveObjectQueue()
thecaller=callerObject thecaller=callerObject
......
...@@ -152,7 +152,7 @@ class Queue(CoreObject): ...@@ -152,7 +152,7 @@ class Queue(CoreObject):
if(callerObject==None): if(callerObject==None):
return len(activeObjectQueue)<self.capacity return len(activeObjectQueue)<self.capacity
thecaller=callerObject thecaller=callerObject
return len(activeObjectQueue)<self.capacity and (self.isInRoute(thecaller)) return len(activeObjectQueue)<self.capacity and (self.isInRouteOf(thecaller))
# ======================================================================= # =======================================================================
# checks if the Queue can dispose an entity to the following object # checks if the Queue can dispose an entity to the following object
...@@ -166,7 +166,7 @@ class Queue(CoreObject): ...@@ -166,7 +166,7 @@ class Queue(CoreObject):
if(callerObject==None): if(callerObject==None):
return len(activeObjectQueue)>0 return len(activeObjectQueue)>0
thecaller=callerObject thecaller=callerObject
return len(activeObjectQueue)>0 and thecaller.isInRoute(self) return len(activeObjectQueue)>0 and thecaller.isInRouteOf(self)
# ======================================================================= # =======================================================================
# removes an entity from the Object # removes an entity from the Object
......
...@@ -53,13 +53,13 @@ class QueueJobShop(Queue): ...@@ -53,13 +53,13 @@ class QueueJobShop(Queue):
#return according to the state of the Queue #return according to the state of the Queue
#check it the caller object holds an Entity that requests for current object #check it the caller object holds an Entity that requests for current object
return len(self.Res.users)<self.capacity\ return len(self.Res.users)<self.capacity\
and self.isInRoute(callerObject) and self.isInRouteOf(callerObject)
#=========================================================================== #===========================================================================
# method used to check whether the station is in the entity-to-be-received route # method used to check whether the station is in the entity-to-be-received route
# TODO: consider giving the activeEntity as attribute # TODO: consider giving the activeEntity as attribute
#=========================================================================== #===========================================================================
def isInRoute(self, callerObject=None): def isInRouteOf(self, callerObject=None):
activeObjectQueue=self.Res.users activeObjectQueue=self.Res.users
thecaller=callerObject thecaller=callerObject
# if the caller is not defined then return True. We are only interested in checking whether # if the caller is not defined then return True. We are only interested in checking whether
...@@ -88,7 +88,7 @@ class QueueJobShop(Queue): ...@@ -88,7 +88,7 @@ class QueueJobShop(Queue):
#return True if the Queue has Entities and the caller is in the self.next list #return True if the Queue has Entities and the caller is in the self.next list
return len(activeObjectQueue)>0\ return len(activeObjectQueue)>0\
and thecaller.isInRoute(self) and thecaller.isInRouteOf(self)
#=========================================================================== #===========================================================================
# extend the default behaviour to check if whether the station # extend the default behaviour to check if whether the station
...@@ -97,7 +97,7 @@ class QueueJobShop(Queue): ...@@ -97,7 +97,7 @@ class QueueJobShop(Queue):
def canAcceptAndIsRequested(self,callerObject=None): def canAcceptAndIsRequested(self,callerObject=None):
giverObject=callerObject giverObject=callerObject
assert giverObject, 'there must be a caller for canAcceptAndIsRequested' assert giverObject, 'there must be a caller for canAcceptAndIsRequested'
if self.isInRoute(giverObject): if self.isInRouteOf(giverObject):
return Queue.canAcceptAndIsRequested(self,giverObject) return Queue.canAcceptAndIsRequested(self,giverObject)
# ======================================================================= # =======================================================================
......
...@@ -80,10 +80,6 @@ class QueueManagedJob(QueueJobShop): ...@@ -80,10 +80,6 @@ class QueueManagedJob(QueueJobShop):
else: else:
haveEntityWithAvailableManager=True haveEntityWithAvailableManager=True
break break
# for entity in [x for x in activeObjectQueue if x.manager]:
# if entity.manager.checkIfResourceIsAvailable(thecaller):
# haveEntityWithAvailableManager=True
# break
#if none of the Entities has an available manager return False #if none of the Entities has an available manager return False
if not haveEntityWithAvailableManager: if not haveEntityWithAvailableManager:
return False return False
...@@ -95,14 +91,6 @@ class QueueManagedJob(QueueJobShop): ...@@ -95,14 +91,6 @@ class QueueManagedJob(QueueJobShop):
# and then perform the default behaviour # and then perform the default behaviour
return QueueJobShop.haveToDispose(self,thecaller) return QueueJobShop.haveToDispose(self,thecaller)
# #if we have only one possible receiver just check if the Queue holds one or more entities
# if(thecaller==None):
# return len(activeObjectQueue)>0
#
# #return True if the Queue has Entities and the caller is the receiver
# return len(activeObjectQueue)>0\
# and (thecaller in activeObject.next)\
# and thecaller.isInRoute(activeObject)
#=========================================================================== #===========================================================================
# signalRouter method # signalRouter method
......
...@@ -59,7 +59,7 @@ class RoutingQueue(Queue): ...@@ -59,7 +59,7 @@ class RoutingQueue(Queue):
if not entity.receiver: if not entity.receiver:
isInRouting=True isInRouting=True
break break
return len(activeObjectQueue)>0 and thecaller.isInRoute(self) and isInRouting return len(activeObjectQueue)>0 and thecaller.isInRouteOf(self) and isInRouting
#=========================================================================== #===========================================================================
# sort the entities of the queue for the receiver # sort the entities of the queue for the receiver
......
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