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
4146eca1
Commit
4146eca1
authored
Dec 09, 2013
by
Georgios Dagkakis
Committed by
Sebastien Robin
Dec 11, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EventGenerator populated with comments
parent
08817d68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
dream/simulation/EventGenerator.py
dream/simulation/EventGenerator.py
+11
-9
No files found.
dream/simulation/EventGenerator.py
View file @
4146eca1
...
...
@@ -34,21 +34,23 @@ class EventGenerator(ObjectInterruption):
ObjectInterruption
.
__init__
(
self
)
self
.
id
=
id
self
.
name
=
name
self
.
start
=
start
self
.
stop
=
stop
self
.
interval
=
interval
self
.
duration
=
duration
self
.
method
=
method
self
.
argumentDict
=
argumentDict
self
.
start
=
start
#the time that the generator will be activated for the first time
self
.
stop
=
stop
#the time that the generator will stop to trigger events
self
.
interval
=
interval
#the interval that the generator sleeps
self
.
duration
=
duration
#the duration that the generation is awake (this is not active for now)
self
.
method
=
method
#the method to be invoked
self
.
argumentDict
=
argumentDict
#the arguments of the method given in a dict
def
run
(
self
):
yield
hold
,
self
,
self
.
start
yield
hold
,
self
,
self
.
start
#wait until the start time
#loop until the end of the simulation
while
1
:
#if the stop time is exceeded then break the loop
if
self
.
stop
:
if
now
()
>
self
.
stop
:
break
self
.
method
(
self
.
argumentDict
)
yield
hold
,
self
,
self
.
interval
self
.
method
(
self
.
argumentDict
)
#call the method
yield
hold
,
self
,
self
.
interval
#wait for the predetermined interval
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