updateNext() updates the next list of an object within the CoreObject getEntity()

parent 31a1b69c
......@@ -241,6 +241,9 @@ class CoreObject(Process):
self.nameLastEntityEntered=activeEntity.name # this holds the name of the last entity that got into Machine
self.downTimeProcessingCurrentEntity=0
# update the next list of the object
activeObject.updateNext(activeEntity)
# local variable to inform if the receiver is operated for Loading
receiverOperated=False
# perform preemption when required
......@@ -279,6 +282,12 @@ class CoreObject(Process):
self.wipStatList.append([now(), len(activeObjectQueue)])
return activeEntity
#===========================================================================
# updates the next list of the object
#===========================================================================
def updateNext(self, entity=None):
pass
#===========================================================================
# find possible receivers
#===========================================================================
......
......@@ -704,11 +704,11 @@ class Machine(CoreObject):
else:
return True
# =======================================================================
# checks if the machine down or it can dispose the object
# =======================================================================
def ifCanDisposeOrHaveFailure(self):
return self.Up==False or self.getReceiverObject().canAccept(self) or len(self.getActiveObjectQueue())==0
# # =======================================================================
# # checks if the machine down or it can dispose the object
# # =======================================================================
# def ifCanDisposeOrHaveFailure(self):
# return self.Up==False or self.getReceiverObject().canAccept(self) or len(self.getActiveObjectQueue())==0
# =======================================================================
# get an entity from the giver
......
......@@ -119,21 +119,27 @@ class MachineJobShop(Machine):
setupTime=activeEntity.remainingRoute[0].get('setupTime',{})
self.distType=setupTime.get('distributionType','Fixed')
self.setupTime=float(setupTime.get('mean', 0))
removedStep = activeEntity.remainingRoute.pop(0) #remove data from the remaining route of the entity
return activeEntity
#===========================================================================
# update the next list of the object based on the activeEentity
#===========================================================================
def updateNext(self,entity=None):
activeObject = self.getActiveObject()
activeEntity=entity
# read the possible receivers - update the next list
import Globals
# read the list of next stations
nextObjectIds=activeEntity.remainingRoute[1].get('stationIdsList',[])
nextObjects = []
for nextObjectId in nextObjectIds:
nextObject=Globals.findObjectById(nextObjectId)
nextObject = Globals.findObjectById(nextObjectId)
nextObjects.append(nextObject)
# update the next list of the object
for nextObject in nextObjects:
# append only if not already in the list
if nextObject not in activeObject.next:
activeObject.next.append(nextObject)
removedStep = activeEntity.remainingRoute.pop(0) #remove data from the remaining route of the entity
return activeEntity
# =======================================================================
# calculates the processing time
......
......@@ -114,6 +114,15 @@ class QueueJobShop(Queue):
def getEntity(self):
activeObject = self.getActiveObject()
activeEntity=Queue.getEntity(self)
activeEntity.remainingRoute.pop(0) #remove data from the remaining route of the entity
return activeEntity
#===========================================================================
# update the next list of the object after reading the remaining list of the activeEntity
#===========================================================================
def updateNext(self,entity=None):
activeObject = self.getActiveObject()
activeEntity=entity
# read the possible receivers - update the next list
import Globals
nextObjectIds=activeEntity.remainingRoute[1].get('stationIdsList',[])
......@@ -126,29 +135,6 @@ class QueueJobShop(Queue):
# append only if not already in the list
if nextObject not in activeObject.next:
activeObject.next.append(nextObject)
# 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
# =======================================================================
# removes an entity from the Queue
......
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