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
13451009
Commit
13451009
authored
May 23, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EntityGenerator has to call the constructor of process in every replication
parent
550cdd88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
dream/simulation/Source.py
dream/simulation/Source.py
+9
-8
No files found.
dream/simulation/Source.py
View file @
13451009
...
...
@@ -49,14 +49,13 @@ class EntityGenerator(Process):
# initialize method of the EntityGenerator
#===========================================================================
def
initialize
(
self
):
pass
#Process.initialize(self)
Process
.
__init__
(
self
)
#===========================================================================
# the generator of the EntitiesGenerator
#===========================================================================
def
run
(
self
):
# print 'entity generator starts'
def
run
(
self
):
print
'1'
while
1
:
entity
=
self
.
victim
.
createEntity
()
# create the Entity object and assign its name
entity
.
creationTime
=
now
()
# assign the current simulation time as the Entity's creation time
...
...
@@ -104,6 +103,7 @@ class Source(CoreObject):
self
.
entityCreated
=
SimEvent
(
'an entity is created'
)
# event used by router
self
.
loadOperatorAvailable
=
SimEvent
(
'loadOperatorAvailable'
)
#===========================================================================
# The initialize method of the Source class
...
...
@@ -111,15 +111,17 @@ class Source(CoreObject):
def
initialize
(
self
):
# using the Process __init__ and not the CoreObject __init__
CoreObject
.
initialize
(
self
)
# initialize the internal Queue (type Resource) of the Source
self
.
Res
=
Resource
(
capacity
=
infinity
)
self
.
Res
.
activeQ
=
[]
self
.
Res
.
waitQ
=
[]
self
.
numberOfArrivals
=
0
self
.
entityGenerator
.
initialize
()
activate
(
self
.
entityGenerator
,
self
.
entityGenerator
.
run
())
self
.
entityCreated
=
SimEvent
(
'an entity is created'
)
# event used by router
self
.
loadOperatorAvailable
=
SimEvent
(
'loadOperatorAvailable'
)
#===========================================================================
# the generator of the Source class
...
...
@@ -128,7 +130,6 @@ class Source(CoreObject):
# get active object and its queue
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
while
1
:
# wait for any event (entity creation or request for disposal of entity)
yield
waitevent
,
self
,
[
self
.
entityCreated
,
self
.
canDispose
,
self
.
loadOperatorAvailable
]
...
...
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