Machine/QueueJobShop.getEntity updated so that other possible receivers are...

Machine/QueueJobShop.getEntity updated so that other possible receivers are not lost. removeEntity updated to remove the possible receivers accordingly
parent e54dade3
......@@ -39,7 +39,7 @@ class MachineJobShop(Machine):
def initialize(self):
from Globals import G
self.previous=G.ObjList
self.next=G.ObjList
self.next=[]
Machine.initialize(self) #run default behaviour
# =======================================================================
......@@ -76,6 +76,7 @@ class MachineJobShop(Machine):
# gets an entity from the predecessor that the predecessor index points to
# =======================================================================
def getEntity(self):
activeObject=self.getActiveObject()
activeEntity=Machine.getEntity(self) #run the default code
# read the processing/setup/load times from the corresponding remainingRoute entry
......@@ -94,9 +95,11 @@ class MachineJobShop(Machine):
for nextObjectId in nextObjectIds:
nextObject=Globals.findObjectById(nextObjectId)
nextObjects.append(nextObject)
self.next=nextObjects
# self.next=Globals.findObjectById(activeEntity.remainingRoute[1].get('stationIdsList',[]))
# self.receiver=Globals.findObjectById(activeEntity.remainingRoute[1][0]) #read the next station
# 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
......@@ -236,4 +239,24 @@ class MachineJobShop(Machine):
loadTime=activeEntity.remainingRoute[0].get('loadTime',{})
self.distType=loadTime.get('loadDistribution','Fixed')
self.loadTime=float(loadTime.get('loadMean', 0))
# =======================================================================
# removes an entity from the Machine
# extension to remove possible receivers accordingly
# =======================================================================
def removeEntity(self, entity=None):
activeObject=self.getActiveObject()
receiverObject=self.receiver
activeEntity=Machine.removeEntity(self, entity) #run the default method
removeReceiver=True
# search in the internalQ. If an entity has the same receiver do not remove
for ent in self.getActiveObjectQueue():
nextObjectIds=ent.remainingRoute[0].get('stationIdsList',[])
if receiverObject.id in nextObjectIds:
removeReceiver=False
# if not entity had the same receiver then the receiver will be removed
if removeReceiver:
activeObject.next.remove(receiverObject)
return activeEntity
\ No newline at end of file
......@@ -40,7 +40,7 @@ class QueueJobShop(Queue):
def initialize(self):
from Globals import G
self.previous=G.ObjList
self.next=G.ObjList
self.next=[]
Queue.initialize(self) #run default behaviour
# =======================================================================
......@@ -104,7 +104,12 @@ class QueueJobShop(Queue):
for nextObjectId in nextObjectIds:
nextObject = Globals.findObjectById(nextObjectId)
nextObjects.append(nextObject)
activeObject.next = nextObjects
# 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)
# 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
......@@ -127,5 +132,25 @@ class QueueJobShop(Queue):
activeEntity.hot = True
activeEntity.remainingRoute.pop(0) #remove data from the remaining route of the entity
return activeEntity
return activeEntity
# =======================================================================
# removes an entity from the Queue
# extension to remove possible receivers accordingly
# =======================================================================
def removeEntity(self, entity=None):
activeObject=self.getActiveObject()
receiverObject=self.receiver
activeEntity=Queue.removeEntity(self, entity) #run the default method
removeReceiver=True
# search in the internalQ. If an entity has the same receiver do not remove
for ent in self.getActiveObjectQueue():
nextObjectIds=ent.remainingRoute[0].get('stationIdsList',[])
if receiverObject.id in nextObjectIds:
removeReceiver=False
# if not entity had the same receiver then the receiver will be removed
if removeReceiver:
activeObject.next.remove(receiverObject)
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