Machine/QueueJobShop updated for OperatorsRouter use

parent 6f14429b
......@@ -41,6 +41,36 @@ class MachineJobShop(Machine):
self.previous=G.ObjList
self.next=G.ObjList
Machine.initialize(self) #run default behaviour
# =======================================================================
# actions to be carried out when the processing of an Entity ends
# =======================================================================
def endProcessingActions(self):
activeObject=self.getActiveObject()
activeObjectQueue=activeObject.getActiveObjectQueue()
activeEntity=activeObjectQueue[0]
import Globals
from Globals import G
# the entity that just got processed is cold again it will get
# hot again by the time it reaches the giver of the next machine
# TODO: Not only Machines require time to process entities
if activeEntity.family=='Job':
# read the list of next stations for the entity in just finished processing
nextObjectIds=activeEntity.remainingRoute[0].get('stationIdsList',[])
nextObjects = []
for nextObjectId in nextObjectIds:
nextObject=Globals.findObjectById(nextObjectId)
nextObjects.append(nextObject)
successorsAreMachines=True
for object in nextObjects:
if not object in G.MachineList:
successorsAreMachines=False
break
if not successorsAreMachines:
activeObjectQueue[0].hot = False
# the just processed entity is added to the list of entities
# pending for the next processing
G.pendingEntities.append(activeObjectQueue[0])
# =======================================================================
# gets an entity from the predecessor that the predecessor index points to
......@@ -186,15 +216,20 @@ class MachineJobShop(Machine):
self.receiver.timeLastEntityEnded=now() #required to count blockage correctly in the preemptied station
reactivate(self)
#just extend the default behaviour in order to read the load time from the Entity to be obtained
#===========================================================================
# just extend the default behaviour in order to read the load time
# from the Entity to be obtained
#===========================================================================
def canAcceptAndIsRequested(self):
if Machine.canAcceptAndIsRequested(self):
self.readLoadTime()
return True
return False
#to be called by canAcceptAndIsRequested if it is to return True.
#the load timeof the Entity must be read
#===========================================================================
# to be called by canAcceptAndIsRequested if it is to return True.
# the load timeof the Entity must be read
#===========================================================================
def readLoadTime(self):
self.giver.sortEntities()
activeEntity=self.giver.getActiveObjectQueue()[0]
......
......@@ -105,6 +105,27 @@ class QueueJobShop(Queue):
nextObject = Globals.findObjectById(nextObjectId)
nextObjects.append(nextObject)
activeObject.next = nextObjects
# TODO: if the successor of the object is a machine that is operated with operationType 'Load'
# then the flag hot of the activeEntity must be set to True
# to signalize that the entity has reached its final destination before the next Machine
# if the entity is not of type Job
if activeEntity.family=='Job':
from Globals import G
successorsAreMachines=True
# for all the objects in the next list
for object in nextObjects:
# if the object is not in the MachineList
# TODO: We must consider also the case that entities can be blocked before they can reach
# the heating point. In such a case they must be removed from the G.pendingEntities list
# and added again after they are unblocked
if not object in G.MachineList:
successorsAreMachines=False
break
# the hot flag should not be raised
if successorsAreMachines:
activeEntity.hot = True
activeEntity.remainingRoute.pop(0) #remove data from the remaining route of the entity
return activeEntity
\ No newline at end of file
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