Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
af2110cd
Commit
af2110cd
authored
Jun 06, 2014
by
Georgios Dagkakis
Committed by
Jérome Perrin
Jun 06, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
further fix in Source to output trace correctly
parent
1ee632de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
13 deletions
+5
-13
dream/simulation/Source.py
dream/simulation/Source.py
+5
-13
No files found.
dream/simulation/Source.py
View file @
af2110cd
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment