Commit ec00842e authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

singalling holder of entity with requiredParts moved from ConditionalBuffer to CoreObject

parent c4312ef0
......@@ -46,28 +46,6 @@ class ConditionalBuffer(QueueJobShop):
schedulingRule="FIFO",**kw):
QueueJobShop.__init__(self, id=id, name=name, capacity=capacity,
isDummy=isDummy, schedulingRule=schedulingRule)
#===========================================================================
# getEntity method
# ass soon as the buffer receives an entity it controls if the entity is requested elsewhere,
# then it checks if there other requested entities by the same requesting entity.
# Finally, it is controlled whether all the requested parts have concluded
# their sequences for the requesting entity
#===========================================================================
def getEntity(self):
activeEntity=QueueJobShop.getEntity(self)
from Globals import G
# for all the entities in the EntityList
for entity in G.EntityList:
requiredParts=entity.getRequiredParts()
if requiredParts:
# if the activeEntity is in the requierdParts of the entity
if activeEntity in requiredParts:
# if the entity that requires the activeEntity can proceed then signal the currentStation of the entity
if entity.checkIfRequiredPartsReady() and entity.currentStation.expectedSignals['canDispose']:
entity.mayProceed=True
self.sendSignal(receiver=entity.currentStation, signal=entity.currentStation.canDispose)
return activeEntity
# =======================================================================
# checks if the Buffer can dispose an entity.
......
......@@ -373,6 +373,23 @@ class CoreObject(ManPyObject):
self.updateNext(activeEntity)
self.outputTrace(activeEntity.name, "got into "+self.objName)
self.printTrace(activeEntity.name, enter=self.id)
# if there are entities with requiredParts then check whether the requirements are fulfilled for them to proceed
# ass soon as a "buffer" receives an entity it controls if the entity is requested elsewhere,
# then it checks if there other requested entities by the same requesting entity.
# Finally, it is controlled whether all the requested parts have concluded
# their sequences for the requesting entity
from Globals import G
# for all the entities in the EntityList
for entity in G.EntityList:
requiredParts=entity.getRequiredParts()
if requiredParts:
# if the activeEntity is in the requierdParts of the entity
if activeEntity in requiredParts:
# if the entity that requires the activeEntity can proceed then signal the currentStation of the entity
if entity.checkIfRequiredPartsReady() and entity.currentStation.expectedSignals['canDispose']:
entity.mayProceed=True
self.sendSignal(receiver=entity.currentStation, signal=entity.currentStation.canDispose)
# if the object (eg Queue) canAccept then signal the Giver
if self.canAccept():
self.signalGiver()
......
......@@ -63,19 +63,4 @@ class ExitJobShop(Exit):
if activeObject.id in activeEntity.remainingRoute[0].get('stationIdsList',[]):
return True
return False
def getEntity(self):
activeEntity = Exit.getEntity(self) #run the default method
from Globals import G
# for all the entities in the EntityList
for entity in G.EntityList:
requiredParts=entity.getRequiredParts()
if requiredParts:
# if the activeEntity is in the requierdParts of the entity
if activeEntity in requiredParts:
# if the entity that requires the activeEntity can proceed then signal the currentStation of the entity
if entity.checkIfRequiredPartsReady() and entity.currentStation.expectedSignals['canDispose']:
self.sendSignal(receiver=entity.currentStation, signal=entity.currentStation.canDispose)
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