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
618b8084
Commit
618b8084
authored
Jun 04, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TwoServersStochastic example updated to match the new notation. Also in the documentation
parent
99719b39
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
34 deletions
+48
-34
ManPy_documentation.doc
ManPy_documentation.doc
+0
-0
ManPy_documentation.pdf
ManPy_documentation.pdf
+0
-0
dream/simulation/Examples/TwoServersStochastic.py
dream/simulation/Examples/TwoServersStochastic.py
+48
-34
No files found.
ManPy_documentation.doc
View file @
618b8084
No preview for this file type
ManPy_documentation.pdf
View file @
618b8084
No preview for this file type
dream/simulation/Examples/TwoServersStochastic.py
View file @
618b8084
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
G
,
Repairman
,
Queue
,
Failure
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
G
,
Repairman
,
Queue
,
Failure
from
dream.simulation.imports
import
simpy
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
#define the objects of the model
R
=
Repairman
(
'R1'
,
'Bob'
)
R
=
Repairman
(
'R1'
,
'Bob'
)
S
=
Source
(
'S1'
,
'Source'
,
interarrivalTime
=
{
'distributionType'
:
'Exp'
,
'mean'
:
0.5
},
entity
=
'Dream.Part'
)
S
=
Source
(
'S1'
,
'Source'
,
interarrivalTime
=
{
'distributionType'
:
'Exp'
,
'mean'
:
0.5
},
entity
=
'Dream.Part'
)
...
@@ -31,40 +28,57 @@ G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
...
@@ -31,40 +28,57 @@ G.maxSimTime=1440.0 #set G.maxSimTime 1440.0 minutes (1 day)
G
.
numberOfReplications
=
10
#set 10 replications
G
.
numberOfReplications
=
10
#set 10 replications
G
.
confidenceLevel
=
0.99
#set the confidence level. 0.99=99%
G
.
confidenceLevel
=
0.99
#set the confidence level. 0.99=99%
#run the replications
def
main
():
for
i
in
range
(
G
.
numberOfReplications
):
throughputList
=
[]
# a list to hold the throughput of each replication
G
.
seed
+=
1
#increment the seed so that we get different random numbers in each run.
#initialize all the objects
for
object
in
G
.
ObjList
:
object
.
initialize
()
for
objectInterruption
in
G
.
ObjectInterruptionList
:
#run the replications
objectInterruption
.
initialize
()
for
i
in
range
(
G
.
numberOfReplications
):
G
.
seed
+=
1
#increment the seed so that we get different random numbers in each run.
for
objectResource
in
G
.
ObjectResourceList
:
G
.
env
=
simpy
.
Environment
()
# define a simpy environment
objectResource
.
initialize
()
# this is where all the simulation object 'live'
#activate all the objects
#initialize all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
G
.
env
.
process
(
object
.
run
())
object
.
initialize
()
for
objectInterruption
in
G
.
ObjectInterruptionList
:
G
.
env
.
process
(
objectInterruption
.
run
())
G
.
env
.
run
(
until
=
G
.
maxSimTime
)
#run the simulation
for
objectInterruption
in
G
.
ObjectInterruptionList
:
objectInterruption
.
initialize
()
#carry on the post processing operations for every object in the topology
for
object
in
G
.
Obj
List
:
for
objectResource
in
G
.
ObjectResource
List
:
object
.
postProcessing
()
objectResource
.
initialize
()
for
objectResource
in
G
.
ObjectResourceList
:
#activate all the objects
objectResource
.
postProcessing
()
for
object
in
G
.
ObjList
:
G
.
env
.
process
(
object
.
run
())
#output data to excel for every object
for
object
in
G
.
ObjList
:
for
objectInterruption
in
G
.
ObjectInterruptionList
:
object
.
outputResultsXL
()
G
.
env
.
process
(
objectInterruption
.
run
())
R
.
outputResultsXL
()
G
.
env
.
run
(
until
=
G
.
maxSimTime
)
#run the simulation
#carry on the post processing operations for every object in the topology
for
object
in
G
.
ObjList
:
object
.
postProcessing
()
for
objectResource
in
G
.
ObjectResourceList
:
objectResource
.
postProcessing
()
G
.
outputFile
.
save
(
"output.xls"
)
# append the numbe of exits in the throughputList
throughputList
.
append
(
E
.
numOfExits
)
print
'The exit of each replication is:'
print
throughputList
# calculate confidence interval using the Knowledge Extraction tool
from
dream.KnowledgeExtraction.ConfidenceIntervals
import
Intervals
from
dream.KnowledgeExtraction.StatisticalMeasures
import
BasicStatisticalMeasures
BSM
=
BasicStatisticalMeasures
()
lb
,
ub
=
Intervals
().
ConfidIntervals
(
throughputList
,
0.95
)
print
'the 95% confidence interval for the throughput is:'
print
'lower bound:'
,
lb
print
'mean:'
,
BSM
.
mean
(
throughputList
)
print
'upper bound:'
,
ub
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
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