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

CoreObjects follow the expectedSignals paradeigm

parent bc5fb8a0
......@@ -62,7 +62,9 @@ class Exit(CoreObject):
self.totalLifespan=0
self.totalTaktTime=0 # the total time between to consecutive exits
self.intervalThroughPutList=[]
self.intervalThroughPutList=[]
self.expectedSignals['isRequested']=1
def run(self):
......
......@@ -86,12 +86,16 @@ class Queue(CoreObject):
self.Res=simpy.Resource(self.env, self.capacity)
# 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
#===========================================================================
def run(self):
def run(self):
activeObjectQueue=self.Res.users
# check if there is WIP and signal receiver
self.initialSignalReceiver()
......
......@@ -63,8 +63,9 @@ class EntityGenerator(object):
self.victim.numberOfArrivals+=1 # we have one new arrival
G.numberOfEntities+=1
self.victim.appendEntity(entity)
succeedTupple=(entity,self.env.now)
self.victim.entityCreated.succeed(succeedTupple)
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
else:
entityCounter=G.numberOfEntities+len(self.victim.scheduledEntities) # this is used just ot output the trace correctly
......@@ -125,6 +126,10 @@ class Source(CoreObject):
# self.loadOperatorAvailable=SimEvent('loadOperatorAvailable')
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,13 +147,12 @@ 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()
if self.loadOperatorAvailable in receivedEvent:
transmitter, eventTime=self.loadOperatorAvailable.value
self.loadOperatorAvailable=self.env.event()
if self.canDispose in receivedEvent:
transmitter, eventTime=self.canDispose.value
self.canDispose=self.env.event()
if self.loadOperatorAvailable in receivedEvent:
transmitter, eventTime=self.loadOperatorAvailable.value
self.loadOperatorAvailable=self.env.event()
if self.haveToDispose():
if self.signalReceiver():
continue
......@@ -198,6 +202,7 @@ class Source(CoreObject):
self.appendEntity(newEntity)
activeEntity=CoreObject.removeEntity(self, entity) # run the default method
if len(self.getActiveObjectQueue())==1:
succeedTuple=(newEntity,self.env.now)
self.entityCreated.succeed(succeedTuple)
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