Commit 5a8adb90 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

CoreObjects follow the expectedSignals paradeigm

parent bc5fb8a0
......@@ -64,6 +64,8 @@ class Exit(CoreObject):
self.totalTaktTime=0 # the total time between to consecutive exits
self.intervalThroughPutList=[]
self.expectedSignals['isRequested']=1
def run(self):
while 1:
......
......@@ -87,6 +87,10 @@ class Queue(CoreObject):
# event used by router
self.loadOperatorAvailable=self.env.event()
self.expectedSignals['isRequested']=1
self.expectedSignals['canDispose']=1
self.expectedSignals['loadOperatorAvailable']=1
#===========================================================================
# run method of the queue
......
......@@ -63,6 +63,7 @@ class EntityGenerator(object):
self.victim.numberOfArrivals+=1 # we have one new arrival
G.numberOfEntities+=1
self.victim.appendEntity(entity)
if self.victim.expectedSignals['entityCreated']:
succeedTupple=(entity,self.env.now)
self.victim.entityCreated.succeed(succeedTupple)
# else put it on the time list for scheduled Entities
......@@ -126,6 +127,10 @@ class Source(CoreObject):
self.loadOperatorAvailable=self.env.event()
self.scheduledEntities=[] # list of creations that are scheduled
self.expectedSignals['entityCreated']=1
self.expectedSignals['loadOperatorAvailable']=1
self.expectedSignals['canDispose']=1
#===========================================================================
# the generator of the Source class
#===========================================================================
......@@ -142,7 +147,6 @@ class Source(CoreObject):
transmitter, eventTime=self.entityCreated.value
self.entityCreated=self.env.event()
# otherwise, if the receiver requests availability then try to signal him if there is anything to dispose of
if self.canDispose in receivedEvent or self.loadOperatorAvailable in receivedEvent:
if self.canDispose in receivedEvent:
transmitter, eventTime=self.canDispose.value
self.canDispose=self.env.event()
......@@ -198,6 +202,7 @@ class Source(CoreObject):
self.appendEntity(newEntity)
activeEntity=CoreObject.removeEntity(self, entity) # run the default method
if len(self.getActiveObjectQueue())==1:
if self.expectedSignals['entityCreated']:
succeedTuple=(newEntity,self.env.now)
self.entityCreated.succeed(succeedTuple)
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