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
10b97050
Commit
10b97050
authored
May 30, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
single server example running
parent
bda75a38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
dream/simulation/Examples/SingleServer.py
dream/simulation/Examples/SingleServer.py
+9
-7
No files found.
dream/simulation/Examples/SingleServer.py
View file @
10b97050
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
G
from
dream.simulation.imports
import
simulate
,
activate
,
initialize
from
dream.simulation.imports
import
simpy
G
.
env
=
simpy
.
Environment
()
# define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model
S
=
Source
(
'S1'
,
'Source'
,
interarrivalTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0.5
},
entity
=
'Dream.Part'
)
...
...
@@ -12,21 +15,20 @@ G.ObjList=[S,M,E] #add all the objects in G.ObjList so that they can be easier
S
.
defineRouting
(
successorList
=
[
M
])
M
.
defineRouting
(
predecessorList
=
[
S
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
initialize
()
#initialize the simulation (SimPy method)
#initialize all the objects
for
object
in
G
.
ObjList
:
object
.
initialize
()
#activate all the objects
for
object
in
G
.
ObjList
:
activate
(
object
,
object
.
run
())
G
.
env
.
process
(
object
.
run
())
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
simulate
(
until
=
G
.
maxSimTime
)
#run the simulation
G
.
env
.
run
(
G
.
maxSimTime
)
#run the simulation
#carry on the post processing operations for every object in the topology
for
object
in
G
.
ObjList
:
...
...
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