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