new method added to OperatorRouter to monitor the movement of pendingEntities

parent 0168e35c
......@@ -52,17 +52,20 @@ class Router(ObjectInterruption):
# =======================================================================
def run(self):
while 1:
yield waituntil,self,self.routerIsCalled # wait until the router is called
# # TESTING
# print 'Router got called'
# wait until the router is called
yield waituntil,self,self.routerIsCalled
# when the router is called for the first time wait till all the entities
# finished all their moves in stations of non-Machine-type
# before they can enter again a type-Machine object
yield waituntil, self,self.entitiesFinishedMoving
from Globals import G
for object in G.MachineList:
if object.inPositionToGet:
object.canProceedWithGetEntity=True
self.inPositionToGet=False
# have to check also the activeCallersList of each machine about to receive something
# # TESTING
# import Globals
......@@ -84,7 +87,33 @@ class Router(ObjectInterruption):
# got first called finished their moves through queues?
#===========================================================================
def entitiesFinishedMoving(self):
pass
# check if the entities waiting to be disposed from different Machines
# the first time the Router is called, have reached the last queue (if any)
# before the next Machine in their route
# from Globals import G
# # pending entities are entities about to enter an other machine, updated by endProcessingActions()
# # if there are any pending entities
# if len(G.pendingEntities):
# # for each one of them
# for entity in G.pendingEntities:
# # if they are residing in a machine which waits to dispose and is functional
# if entity.currentStation in G.MachineList:
# if entity.currentStation.checkIfMachineIsUp()\
# and entity.currentStation.waitToDispose:
# # if the next step in the entity's route is machine with Load operationType then continue
# if (not (entity.currentStation.receiver.type in G.MachineList)\
# and entity.currentStation.receiver.canAccept()\
# or\
# ((entity.currentStation.receiver.type in G.MachineList)\
# and not any(type=='Load' for type in entity.currentStation.receiver.multOperationTypeList))):
# return False
# elif entity.currentStation in G.QueueList:
# pass
# elif entity.currentStation in G.LineClearanceList:
# pass
# # this list can check all the available object in G.objList
return True
# =======================================================================
# call the Scheduler
......
......@@ -83,9 +83,12 @@ class Queue(CoreObject):
def initialize(self):
# using the Process __init__ and not the CoreObject __init__
CoreObject.initialize(self)
# initialize the internal Queue (type Resource) of the Queue object
# initialise the internal Queue (type Resource) of the Queue object
self.Res=Resource(self.capacity)
#===========================================================================
# run method of the queue
#===========================================================================
def run(self):
activeObjectQueue=self.getActiveObjectQueue()
......@@ -97,6 +100,7 @@ class Queue(CoreObject):
#if entity just got to the dummyQ set its startTime as the current time
if self.isDummy:
activeObjectQueue[0].startTime=now()
# =======================================================================
# checks if the Queue can accept an entity
# it checks also who called it and returns TRUE
......@@ -138,10 +142,6 @@ class Queue(CoreObject):
#if we have only one possible receiver just check if the Queue holds one or more entities
if(len(activeObject.next)==1 or callerObject==None):
return len(self.Res.activeQ)>0
# #if the Queue is empty it returns false right away
# if(len(activeObjectQueue)==0):
# return False
thecaller=callerObject
......
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