entity appended to receiver internal queue from removeEntity of the giver

parent 6ed62573
......@@ -165,6 +165,10 @@ class CoreObject(Process):
activeObjectQueue=self.getActiveObjectQueue()
activeObjectQueue.remove(entity) #remove the Entity from the queue
if self.receiver:
receiverObject=self.getReceiverObject()
receiverObjectQueue=receiverObject.getActiveObjectQueue()
receiverObjectQueue.append(entity)
self.failureTimeInCurrentEntity=0
self.downTimeInTryingToReleaseCurrentEntity=0
......@@ -214,17 +218,18 @@ class CoreObject(Process):
# if the giverObject is blocked then unBlock it
if giverObject.exitIsAssignedTo():
giverObject.unAssignExit()
# if the activeObject entry is blocked then unBlock it
if activeObject.entryIsAssignedTo():
activeObject.unAssignEntry()
# remove entity from the giver
activeEntity = giverObject.removeEntity(entity=self.identifyEntityToGet())
# variable that holds the last giver; used in case of preemption
self.lastGiver=self.giver
#get the entity from the previous object and put it in front of the activeQ
activeObjectQueue.append(activeEntity)
# #get the entity from the previous object and put it in front of the activeQ
# activeObjectQueue.append(activeEntity)
# if the activeObject entry is blocked then unBlock it
if activeObject.entryIsAssignedTo():
activeObject.unAssignEntry()
#append the time to schedule so that it can be read in the result
#remember that every entity has it's schedule which is supposed to be updated every time
# he entity enters a new object
......@@ -325,6 +330,7 @@ class CoreObject(Process):
while not activeObject.receiver.canAcceptAndIsRequested():
possibleReceivers.remove(activeObject.receiver)
if not possibleReceivers:
# print self.id, 'reseting receiver'
activeObject.receiver.giver=None
activeObject.receiver=None
return False
......
......@@ -225,8 +225,10 @@ class Machine(CoreObject):
# waitEvent isRequested /interruptionEnd/loadOperatorAvailable
while 1:
yield waitevent, self, [self.isRequested, self.interruptionEnd, self.loadOperatorAvailable]
# print now(), self.id, 'received an event'
# if the machine can accept an entity and one predecessor requests it continue with receiving the entity
if self.isRequested.signalparam:
# print now(), self.id, 'received an isRequested event from', self.isRequested.signalparam.id
assert self.isRequested.signalparam==self.giver, 'the giver is not the requestingObject'
assert self.giver.receiver==self, 'the receiver of the signalling object in not the station'
# reset the signalparam of the isRequested event
......
......@@ -101,8 +101,15 @@ class Queue(CoreObject):
#if entity just got to the dummyQ set its startTime as the current time
if self.isDummy:
activeObjectQueue[0].startTime=now()
# if self.canDispose.signalparam:
# print now(), self.id, 'received a canDispose event from', self.canDispose.signalparam
# if the event that activated the thread is canDispose then signalReceiver
if self.haveToDispose():
# print now(), self.id, 'will try to signal a receiver from generator'
if self.receiver:
if not self.receiver.entryIsAssignedTo():
self.signalReceiver()
continue
self.signalReceiver()
......@@ -152,6 +159,7 @@ class Queue(CoreObject):
# TODO: disable that for the mouldAssemblyBuffer
if not self.__class__.__name__=='MouldAssemblyBuffer':
if self.haveToDispose():
# print now(), self.id, 'will try to signal a receiver from removeEntity'
self.signalReceiver()
return activeEntity
......
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