Commit af2110cd authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

further fix in Source to output trace correctly

parent 1ee632de
...@@ -45,13 +45,7 @@ class EntityGenerator(object): ...@@ -45,13 +45,7 @@ class EntityGenerator(object):
self.env=G.env self.env=G.env
self.type="EntityGenerator" #String that shows the type of object self.type="EntityGenerator" #String that shows the type of object
self.victim=victim self.victim=victim
# #===========================================================================
# # initialize method of the EntityGenerator
# #===========================================================================
# def initialize(self):
# Process.__init__(self)
#=========================================================================== #===========================================================================
# the generator of the EntitiesGenerator # the generator of the EntitiesGenerator
#=========================================================================== #===========================================================================
...@@ -72,10 +66,9 @@ class EntityGenerator(object): ...@@ -72,10 +66,9 @@ class EntityGenerator(object):
self.victim.entityCreated.succeed(entity) self.victim.entityCreated.succeed(entity)
# else put it on the time list for scheduled Entities # else put it on the time list for scheduled Entities
else: else:
#print self.env.now, 'appending to the list' entityCounter=G.numberOfEntities+len(self.victim.scheduledEntities) # this is used just ot output the trace correctly
self.victim.scheduledEntities.append(self.env.now) self.victim.scheduledEntities.append(self.env.now)
self.victim.outputTrace(entity.name, "generated") # output the trace self.victim.outputTrace(self.victim.item.type+str(entityCounter), "generated") # output the trace
G.numberOfEntities+=1
yield self.env.timeout(self.victim.calculateInterarrivalTime()) # wait until the next arrival yield self.env.timeout(self.victim.calculateInterarrivalTime()) # wait until the next arrival
#============================================================================ #============================================================================
...@@ -104,8 +97,7 @@ class Source(CoreObject): ...@@ -104,8 +97,7 @@ class Source(CoreObject):
self.item=Globals.getClassFromName(entity) #the type of object that the Source will generate self.item=Globals.getClassFromName(entity) #the type of object that the Source will generate
self.scheduledEntities=[] # list of creations that are scheduled self.scheduledEntities=[] # list of creations that are scheduled. pattern is [timeOfCreation, EntityCounter]
#=========================================================================== #===========================================================================
# The initialize method of the Source class # The initialize method of the Source class
...@@ -189,7 +181,7 @@ class Source(CoreObject): ...@@ -189,7 +181,7 @@ class Source(CoreObject):
def removeEntity(self, entity=None): def removeEntity(self, entity=None):
if len(self.getActiveObjectQueue())==1 and len(self.scheduledEntities): if len(self.getActiveObjectQueue())==1 and len(self.scheduledEntities):
newEntity=self.createEntity() # create the Entity object and assign its name newEntity=self.createEntity() # create the Entity object and assign its name
newEntity.creationTime=self.scheduledEntities.pop(0) # assign the current simulation time as the Entity's creation time newEntity.creationTime=self.scheduledEntities.pop(0) # assign the current simulation time as the Entity's creation time
newEntity.startTime=newEntity.creationTime # assign the current simulation time as the Entity's start time newEntity.startTime=newEntity.creationTime # assign the current simulation time as the Entity's start time
#print self.env.now, 'getting from the list. StartTime=',newEntity.startTime #print self.env.now, 'getting from the list. StartTime=',newEntity.startTime
newEntity.currentStation=self # update the current station of the Entity newEntity.currentStation=self # update the current station of the Entity
......
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