printTrace comments modified

parent b18fd0e2
...@@ -286,6 +286,7 @@ class Conveyer(CoreObject): ...@@ -286,6 +286,7 @@ class Conveyer(CoreObject):
if self.isFull(): if self.isFull():
self.timeBlockageStarted=now() self.timeBlockageStarted=now()
self.wasFull=True self.wasFull=True
self.printTrace(self.id, 'is now Full '+str(len(self.getActiveObjectQueue()))+' (*) '*20)
return activeEntity return activeEntity
#=========================================================================== #===========================================================================
......
...@@ -326,7 +326,7 @@ class CoreObject(Process): ...@@ -326,7 +326,7 @@ class CoreObject(Process):
# signal the successor that the object can dispose an entity # signal the successor that the object can dispose an entity
# ======================================================================= # =======================================================================
def signalReceiver(self): def signalReceiver(self):
self.printTrace(self.id, 'trying to signal receiver') # self.printTrace(self.id, 'trying to signal receiver')
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
possibleReceivers=activeObject.findReceivers() possibleReceivers=activeObject.findReceivers()
if possibleReceivers: if possibleReceivers:
......
...@@ -221,12 +221,12 @@ class Machine(CoreObject): ...@@ -221,12 +221,12 @@ class Machine(CoreObject):
while 1: while 1:
# waitEvent isRequested /interruptionEnd/loadOperatorAvailable # waitEvent isRequested /interruptionEnd/loadOperatorAvailable
while 1: while 1:
# self.printTrace(self.id, 'will wait for event') self.printTrace(self.id, 'will wait for event')
yield waitevent, self, [self.isRequested, self.interruptionEnd, self.loadOperatorAvailable] yield waitevent, self, [self.isRequested, self.interruptionEnd, self.loadOperatorAvailable]
# self.printTrace(self.id, 'received an event') self.printTrace(self.id, 'received an event')
# if the machine can accept an entity and one predecessor requests it continue with receiving the entity # if the machine can accept an entity and one predecessor requests it continue with receiving the entity
if self.isRequested.signalparam: if self.isRequested.signalparam:
# self.printTrace(self.id, 'received an isRequested event from'+self.isRequested.signalparam.id) self.printTrace(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.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' assert self.giver.receiver==self, 'the receiver of the signalling object in not the station'
# reset the signalparam of the isRequested event # reset the signalparam of the isRequested event
...@@ -235,10 +235,10 @@ class Machine(CoreObject): ...@@ -235,10 +235,10 @@ class Machine(CoreObject):
# if an interruption caused the control to be taken by the machine or # if an interruption caused the control to be taken by the machine or
# if an operator was rendered available while it was needed by the machine to proceed with getEntity # if an operator was rendered available while it was needed by the machine to proceed with getEntity
if self.interruptionEnd.signalparam==now() or self.loadOperatorAvailable.signalparam==now(): if self.interruptionEnd.signalparam==now() or self.loadOperatorAvailable.signalparam==now():
# if self.interruptionEnd.signalparam==now(): if self.interruptionEnd.signalparam==now():
# self.printTrace(self.id, 'received an interruptionEnd event sent at '+self.interruptionEnd.signalparam) self.printTrace(self.id, 'received an interruptionEnd event sent at '+str(self.interruptionEnd.signalparam))
# elif self.loadOperatorAvailable.signalparam==now(): elif self.loadOperatorAvailable.signalparam==now():
# self.printTrace(self.id, 'received an loadOperatorAvailable event sent at '+self.loadOperatorAvailable.signalparam) self.printTrace(self.id, 'received an loadOperatorAvailable event sent at '+str(self.loadOperatorAvailable.signalparam))
# try to signal the Giver, otherwise wait until it is requested # try to signal the Giver, otherwise wait until it is requested
if self.signalGiver(): if self.signalGiver():
break break
...@@ -698,7 +698,7 @@ class Machine(CoreObject): ...@@ -698,7 +698,7 @@ class Machine(CoreObject):
activeObject.waitToDispose=False # update the waitToDispose flag activeObject.waitToDispose=False # update the waitToDispose flag
# if the Machine canAccept then signal a giver # if the Machine canAccept then signal a giver
if activeObject.canAccept(): if activeObject.canAccept():
# self.printTrace(self.id, 'will try signalling a giver from removeEntity') self.printTrace(self.id, 'will try signalling a giver from removeEntity')
activeObject.signalGiver() activeObject.signalGiver()
return activeEntity return activeEntity
......
...@@ -93,13 +93,13 @@ class Queue(CoreObject): ...@@ -93,13 +93,13 @@ class Queue(CoreObject):
# check if there is WIP and signal receiver # check if there is WIP and signal receiver
self.initialSignalReceiver() self.initialSignalReceiver()
while 1: while 1:
# self.printTrace(self.id, 'will wait for event') self.printTrace(self.id, 'will wait for event')
# wait until the Queue can accept an entity and one predecessor requests it # wait until the Queue can accept an entity and one predecessor requests it
yield waitevent, self, [self.isRequested,self.canDispose, self.loadOperatorAvailable] yield waitevent, self, [self.isRequested,self.canDispose, self.loadOperatorAvailable]
# self.printTrace(self.id, 'just received an event') self.printTrace(self.id, 'just received an event')
# if the event that activated the thread is isRequested then getEntity # if the event that activated the thread is isRequested then getEntity
if self.isRequested.signalparam: if self.isRequested.signalparam:
# self.printTrace(self.id, 'received a isRequested event from'+self.isRequested.signalparam.id) self.printTrace(self.id, 'received a isRequested event from'+self.isRequested.signalparam.id)
# reset the isRequested signal parameter # reset the isRequested signal parameter
self.isRequested.signalparam=None self.isRequested.signalparam=None
self.getEntity() self.getEntity()
...@@ -112,11 +112,11 @@ class Queue(CoreObject): ...@@ -112,11 +112,11 @@ class Queue(CoreObject):
self.loadOperatorAvailable.signalparam=None self.loadOperatorAvailable.signalparam=None
# if the queue received an canDispose with signalparam time, this means that the signals was sent from a MouldAssemblyBuffer # if the queue received an canDispose with signalparam time, this means that the signals was sent from a MouldAssemblyBuffer
if self.canDispose.signalparam: if self.canDispose.signalparam:
# self.printTrace(self.id, 'received a canDispose event') self.printTrace(self.id, 'received a canDispose event')
self.canDispose.signalparam=None self.canDispose.signalparam=None
# if the event that activated the thread is canDispose then signalReceiver # if the event that activated the thread is canDispose then signalReceiver
if self.haveToDispose(): if self.haveToDispose():
# self.printTrace(self.id, 'will try to signal a receiver from generator') self.printTrace(self.id, 'will try to signal a receiver from generator')
if self.receiver: if self.receiver:
if not self.receiver.entryIsAssignedTo(): if not self.receiver.entryIsAssignedTo():
self.signalReceiver() self.signalReceiver()
...@@ -169,7 +169,7 @@ class Queue(CoreObject): ...@@ -169,7 +169,7 @@ class Queue(CoreObject):
# TODO: disable that for the mouldAssemblyBuffer # TODO: disable that for the mouldAssemblyBuffer
if not self.__class__.__name__=='MouldAssemblyBuffer': if not self.__class__.__name__=='MouldAssemblyBuffer':
if self.haveToDispose(): if self.haveToDispose():
# self.printTrace(self.id, 'will try to signal a receiver from removeEntity') self.printTrace(self.id, 'will try to signal a receiver from removeEntity')
self.signalReceiver() self.signalReceiver()
return activeEntity return activeEntity
......
...@@ -177,6 +177,7 @@ class Source(CoreObject): ...@@ -177,6 +177,7 @@ class Source(CoreObject):
# creates an Entity # creates an Entity
#============================================================================ #============================================================================
def createEntity(self): def createEntity(self):
self.printTrace(self.id, 'created an entity')
return self.item(id = self.item.type+str(G.numberOfEntities), name = self.item.type+str(self.numberOfArrivals)) #return the newly created Entity return self.item(id = self.item.type+str(G.numberOfEntities), name = self.item.type+str(self.numberOfArrivals)) #return the newly created Entity
#============================================================================ #============================================================================
# calculates the processing time # calculates the processing time
......
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