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
0c200e84
Commit
0c200e84
authored
Feb 14, 2014
by
Georgios Dagkakis
Committed by
Jérome Perrin
Feb 19, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enhancements in Examples
parent
6d1d9adc
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
33 deletions
+70
-33
dream/simulation/Examples/AssemblyLine.py
dream/simulation/Examples/AssemblyLine.py
+12
-3
dream/simulation/Examples/ParallelServers1.py
dream/simulation/Examples/ParallelServers1.py
+13
-3
dream/simulation/Examples/ParallelServers2.py
dream/simulation/Examples/ParallelServers2.py
+14
-6
dream/simulation/Examples/ParallelServers3.py
dream/simulation/Examples/ParallelServers3.py
+13
-4
dream/simulation/Examples/Trace.xls
dream/simulation/Examples/Trace.xls
+0
-0
dream/simulation/Examples/TwoServers.py
dream/simulation/Examples/TwoServers.py
+6
-5
dream/simulation/Examples/TwoServersPlots.py
dream/simulation/Examples/TwoServersPlots.py
+5
-5
dream/simulation/Examples/TwoServersStochastic.py
dream/simulation/Examples/TwoServersStochastic.py
+7
-7
No files found.
dream/simulation/Examples/AssemblyLine.py
View file @
0c200e84
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
Frame
,
Assembly
,
G
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
Frame
,
Assembly
,
Failure
,
G
from
dream.simulation.imports
import
simulate
,
activate
,
initialize
from
dream.simulation.imports
import
simulate
,
activate
,
initialize
#define the objects of the model
#define the objects of the model
Frame
.
capacity
=
4
Frame
.
capacity
=
4
Sp
=
Source
(
'SP'
,
'Parts'
,
mean
=
0.5
,
item
=
Part
)
Sp
=
Source
(
'SP'
,
'Parts'
,
mean
=
0.5
,
item
=
Part
)
Sf
=
Source
(
'SF'
,
'Frames'
,
mean
=
2
,
item
=
Frame
)
Sf
=
Source
(
'SF'
,
'Frames'
,
mean
=
2
,
item
=
Frame
)
M
=
Machine
(
'M'
,
'Machine'
,
mean
=
0.25
,
failureDistribution
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
M
=
Machine
(
'M'
,
'Machine'
,
mean
=
0.25
)
A
=
Assembly
(
'A'
,
'Assembly'
,
mean
=
2
)
A
=
Assembly
(
'A'
,
'Assembly'
,
mean
=
2
)
E
=
Exit
(
'E1'
,
'Exit'
)
E
=
Exit
(
'E1'
,
'Exit'
)
F
=
Failure
(
victim
=
M
,
distributionType
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
G
.
ObjList
=
[
Sp
,
Sf
,
M
,
A
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjList
=
[
Sp
,
Sf
,
M
,
A
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjectInterruptionList
=
[
F
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
#define predecessors and successors for the objects
Sp
.
defineRouting
([
A
])
Sp
.
defineRouting
([
A
])
Sf
.
defineRouting
([
A
])
Sf
.
defineRouting
([
A
])
...
@@ -20,14 +24,19 @@ E.defineRouting([M])
...
@@ -20,14 +24,19 @@ E.defineRouting([M])
initialize
()
#initialize the simulation (SimPy method)
initialize
()
#initialize the simulation (SimPy method)
#initialize all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
object
.
initialize
()
object
.
initialize
()
for
objectInterruption
in
G
.
ObjectInterruptionList
:
objectInterruption
.
initialize
()
#activate all the objects
#activate all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
activate
(
object
,
object
.
run
())
activate
(
object
,
object
.
run
())
for
objectInterruption
in
G
.
ObjectInterruptionList
:
activate
(
objectInterruption
,
objectInterruption
.
run
())
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
simulate
(
until
=
G
.
maxSimTime
)
#run the simulation
simulate
(
until
=
G
.
maxSimTime
)
#run the simulation
...
...
dream/simulation/Examples/ParallelServers1.py
View file @
0c200e84
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
Queue
,
G
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
Queue
,
G
,
Failure
from
dream.simulation.imports
import
simulate
,
activate
,
initialize
,
infinity
from
dream.simulation.imports
import
simulate
,
activate
,
initialize
,
infinity
#define the objects of the model
#define the objects of the model
S
=
Source
(
'S'
,
'Source'
,
mean
=
0.5
,
item
=
Part
)
S
=
Source
(
'S'
,
'Source'
,
mean
=
0.5
,
item
=
Part
)
Q
=
Queue
(
'Q'
,
'Queue'
,
capacity
=
infinity
)
Q
=
Queue
(
'Q'
,
'Queue'
,
capacity
=
infinity
)
M1
=
Machine
(
'M1'
,
'Milling1'
,
mean
=
0.25
,
failureDistribution
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
M1
=
Machine
(
'M1'
,
'Milling1'
,
mean
=
0.25
)
M2
=
Machine
(
'M2'
,
'Milling2'
,
mean
=
0.25
)
M2
=
Machine
(
'M2'
,
'Milling2'
,
mean
=
0.25
)
E
=
Exit
(
'E1'
,
'Exit'
)
E
=
Exit
(
'E1'
,
'Exit'
)
F
=
Failure
(
victim
=
M1
,
distributionType
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
G
.
ObjList
=
[
S
,
Q
,
M1
,
M2
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjList
=
[
S
,
Q
,
M1
,
M2
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjectInterruptionList
=
[
F
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
#define predecessors and successors for the objects
S
.
defineRouting
([
Q
])
S
.
defineRouting
([
Q
])
Q
.
defineRouting
([
S
],[
M1
,
M2
])
Q
.
defineRouting
([
S
],[
M1
,
M2
])
...
@@ -19,14 +24,19 @@ E.defineRouting([M1,M2])
...
@@ -19,14 +24,19 @@ E.defineRouting([M1,M2])
initialize
()
#initialize the simulation (SimPy method)
initialize
()
#initialize the simulation (SimPy method)
#initialize all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
object
.
initialize
()
object
.
initialize
()
for
objectInterruption
in
G
.
ObjectInterruptionList
:
objectInterruption
.
initialize
()
#activate all the objects
#activate all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
activate
(
object
,
object
.
run
())
activate
(
object
,
object
.
run
())
for
objectInterruption
in
G
.
ObjectInterruptionList
:
activate
(
objectInterruption
,
objectInterruption
.
run
())
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
simulate
(
until
=
G
.
maxSimTime
)
#run the simulation
simulate
(
until
=
G
.
maxSimTime
)
#run the simulation
...
...
dream/simulation/Examples/ParallelServers2.py
View file @
0c200e84
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
Queue
,
G
,
Globals
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
Queue
,
G
,
Globals
,
Failure
from
dream.simulation.imports
import
simulate
,
activate
,
initialize
,
infinity
from
dream.simulation.imports
import
simulate
,
activate
,
initialize
,
infinity
#the custom queue
#the custom queue
...
@@ -16,13 +16,18 @@ class SelectiveQueue(Queue):
...
@@ -16,13 +16,18 @@ class SelectiveQueue(Queue):
#define the objects of the model
#define the objects of the model
S
=
Source
(
'S'
,
'Source'
,
mean
=
0.5
,
item
=
Part
)
S
=
Source
(
'S'
,
'Source'
,
mean
=
0.5
,
item
=
Part
)
Q
=
SelectiveQueue
(
'Q'
,
'Queue'
,
capacity
=
infinity
)
#Q is now of type SelectiveQueue
Q
=
SelectiveQueue
(
'Q'
,
'Queue'
,
capacity
=
infinity
)
M1
=
Machine
(
'M1'
,
'Milling1'
,
mean
=
0.25
,
failureDistribution
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
M1
=
Machine
(
'M1'
,
'Milling1'
,
mean
=
0.25
)
M2
=
Machine
(
'M2'
,
'Milling2'
,
mean
=
0.25
)
M2
=
Machine
(
'M2'
,
'Milling2'
,
mean
=
0.25
)
E
=
Exit
(
'E1'
,
'Exit'
)
E
=
Exit
(
'E1'
,
'Exit'
)
F
=
Failure
(
victim
=
M1
,
distributionType
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
G
.
ObjList
=
[
S
,
Q
,
M1
,
M2
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjList
=
[
S
,
Q
,
M1
,
M2
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjectInterruptionList
=
[
F
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
#define predecessors and successors for the objects
S
.
defineRouting
([
Q
])
S
.
defineRouting
([
Q
])
Q
.
defineRouting
([
S
],[
M1
,
M2
])
Q
.
defineRouting
([
S
],[
M1
,
M2
])
...
@@ -32,14 +37,19 @@ E.defineRouting([M1,M2])
...
@@ -32,14 +37,19 @@ E.defineRouting([M1,M2])
initialize
()
#initialize the simulation (SimPy method)
initialize
()
#initialize the simulation (SimPy method)
#initialize all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
object
.
initialize
()
object
.
initialize
()
for
objectInterruption
in
G
.
ObjectInterruptionList
:
objectInterruption
.
initialize
()
#activate all the objects
#activate all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
activate
(
object
,
object
.
run
())
activate
(
object
,
object
.
run
())
for
objectInterruption
in
G
.
ObjectInterruptionList
:
activate
(
objectInterruption
,
objectInterruption
.
run
())
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
simulate
(
until
=
G
.
maxSimTime
)
#run the simulation
simulate
(
until
=
G
.
maxSimTime
)
#run the simulation
...
@@ -52,5 +62,3 @@ for object in G.ObjList:
...
@@ -52,5 +62,3 @@ for object in G.ObjList:
print
"the system produced"
,
E
.
numOfExits
,
"parts"
print
"the system produced"
,
E
.
numOfExits
,
"parts"
print
"the working ratio of"
,
M1
.
objName
,
"is"
,
(
M1
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
,
"%"
print
"the working ratio of"
,
M1
.
objName
,
"is"
,
(
M1
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
,
"%"
print
"the working ratio of"
,
M2
.
objName
,
"is"
,
(
M2
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
,
"%"
print
"the working ratio of"
,
M2
.
objName
,
"is"
,
(
M2
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
,
"%"
dream/simulation/Examples/ParallelServers3.py
View file @
0c200e84
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
Queue
,
G
,
Globals
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
Queue
,
G
,
Globals
,
Failure
from
dream.simulation.imports
import
simulate
,
activate
,
initialize
,
infinity
from
dream.simulation.imports
import
simulate
,
activate
,
initialize
,
infinity
#the custom queue
#the custom queue
...
@@ -36,13 +36,17 @@ class CountingExit(Exit):
...
@@ -36,13 +36,17 @@ class CountingExit(Exit):
#define the objects of the model
#define the objects of the model
S
=
Source
(
'S'
,
'Source'
,
mean
=
0.5
,
item
=
Part
)
S
=
Source
(
'S'
,
'Source'
,
mean
=
0.5
,
item
=
Part
)
Q
=
SelectiveQueue
(
'Q'
,
'Queue'
,
capacity
=
infinity
)
Q
=
SelectiveQueue
(
'Q'
,
'Queue'
,
capacity
=
infinity
)
M1
=
Milling
(
'M1'
,
'Milling1'
,
mean
=
0.25
,
failureDistribution
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
M1
=
Milling
(
'M1'
,
'Milling1'
,
mean
=
0.25
)
M2
=
Milling
(
'M2'
,
'Milling2'
,
mean
=
0.25
)
M2
=
Milling
(
'M2'
,
'Milling2'
,
mean
=
0.25
)
E
=
CountingExit
(
'E1'
,
'Exit'
)
E
=
CountingExit
(
'E1'
,
'Exit'
)
F
=
Failure
(
victim
=
M1
,
distributionType
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
G
.
ObjList
=
[
S
,
Q
,
M1
,
M2
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjList
=
[
S
,
Q
,
M1
,
M2
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
#create the global variables
G
.
ObjectInterruptionList
=
[
F
]
#add all the objects in G.ObjList so that they can be easier accessed later
#create the global counter variables
G
.
NumM1
=
0
G
.
NumM1
=
0
G
.
NumM2
=
0
G
.
NumM2
=
0
...
@@ -55,14 +59,19 @@ E.defineRouting([M1,M2])
...
@@ -55,14 +59,19 @@ E.defineRouting([M1,M2])
initialize
()
#initialize the simulation (SimPy method)
initialize
()
#initialize the simulation (SimPy method)
#initialize all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
object
.
initialize
()
object
.
initialize
()
for
objectInterruption
in
G
.
ObjectInterruptionList
:
objectInterruption
.
initialize
()
#activate all the objects
#activate all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
activate
(
object
,
object
.
run
())
activate
(
object
,
object
.
run
())
for
objectInterruption
in
G
.
ObjectInterruptionList
:
activate
(
objectInterruption
,
objectInterruption
.
run
())
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
simulate
(
until
=
G
.
maxSimTime
)
#run the simulation
simulate
(
until
=
G
.
maxSimTime
)
#run the simulation
...
...
dream/simulation/Examples/Trace.xls
View file @
0c200e84
No preview for this file type
dream/simulation/Examples/TwoServers.py
View file @
0c200e84
...
@@ -15,7 +15,7 @@ F2=Failure(victim=M2, distributionType='Fixed', MTTF=40, MTTR=10, repairman=R)
...
@@ -15,7 +15,7 @@ F2=Failure(victim=M2, distributionType='Fixed', MTTF=40, MTTR=10, repairman=R)
G
.
ObjList
=
[
S
,
M1
,
M2
,
E
,
Q
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjList
=
[
S
,
M1
,
M2
,
E
,
Q
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
Failure
List
=
[
F1
,
F2
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjectInterruption
List
=
[
F1
,
F2
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
#define predecessors and successors for the objects
S
.
defineRouting
([
M1
])
S
.
defineRouting
([
M1
])
...
@@ -32,15 +32,16 @@ R.initialize()
...
@@ -32,15 +32,16 @@ R.initialize()
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
object
.
initialize
()
object
.
initialize
()
for
failure
in
G
.
Failure
List
:
for
objectInterruption
in
G
.
ObjectInterruption
List
:
failure
.
initialize
()
objectInterruption
.
initialize
()
#activate all the objects
#activate all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
activate
(
object
,
object
.
run
())
activate
(
object
,
object
.
run
())
for
failure
in
G
.
FailureList
:
for
objectInterruption
in
G
.
ObjectInterruptionList
:
activate
(
failure
,
failure
.
run
())
activate
(
objectInterruption
,
objectInterruption
.
run
())
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
...
...
dream/simulation/Examples/TwoServersPlots.py
View file @
0c200e84
...
@@ -18,7 +18,7 @@ F2=Failure(victim=M2, distributionType='Fixed', MTTF=40, MTTR=10, repairman=R)
...
@@ -18,7 +18,7 @@ F2=Failure(victim=M2, distributionType='Fixed', MTTF=40, MTTR=10, repairman=R)
G
.
ObjList
=
[
S
,
M1
,
M2
,
E
,
Q
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjList
=
[
S
,
M1
,
M2
,
E
,
Q
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
Failure
List
=
[
F1
,
F2
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjectInterruption
List
=
[
F1
,
F2
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
#define predecessors and successors for the objects
S
.
defineRouting
([
M1
])
S
.
defineRouting
([
M1
])
...
@@ -35,15 +35,15 @@ R.initialize()
...
@@ -35,15 +35,15 @@ R.initialize()
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
object
.
initialize
()
object
.
initialize
()
for
failure
in
G
.
Failure
List
:
for
objectInterruption
in
G
.
ObjectInterruption
List
:
failure
.
initialize
()
objectInterruption
.
initialize
()
#activate all the objects
#activate all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
activate
(
object
,
object
.
run
())
activate
(
object
,
object
.
run
())
for
failure
in
G
.
Failure
List
:
for
objectInterruption
in
G
.
ObjectInterruption
List
:
activate
(
failure
,
failure
.
run
())
activate
(
objectInterruption
,
objectInterruption
.
run
())
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
...
...
dream/simulation/Examples/TwoServersStochastic.py
View file @
0c200e84
...
@@ -15,7 +15,7 @@ F2=Failure(victim=M2, distributionType='Fixed', MTTF=40, MTTR=10, repairman=R)
...
@@ -15,7 +15,7 @@ F2=Failure(victim=M2, distributionType='Fixed', MTTF=40, MTTR=10, repairman=R)
G
.
ObjList
=
[
S
,
M1
,
M2
,
E
,
Q
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjList
=
[
S
,
M1
,
M2
,
E
,
Q
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
Failure
List
=
[
F1
,
F2
]
#add all the objects in G.ObjList so that they can be easier accessed later
G
.
ObjectInterruption
List
=
[
F1
,
F2
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
#define predecessors and successors for the objects
S
.
defineRouting
([
M1
])
S
.
defineRouting
([
M1
])
...
@@ -38,16 +38,16 @@ for i in range(G.numberOfReplications):
...
@@ -38,16 +38,16 @@ for i in range(G.numberOfReplications):
R
.
initialize
()
R
.
initialize
()
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
object
.
initialize
()
object
.
initialize
()
for
failure
in
G
.
Failure
List
:
for
objectInterruption
in
G
.
ObjectInterruption
List
:
failure
.
initialize
()
objectInterruption
.
initialize
()
#activate all the objects
#activate all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
:
activate
(
object
,
object
.
run
())
activate
(
object
,
object
.
run
())
for
failure
in
G
.
Failure
List
:
for
objectInterruption
in
G
.
ObjectInterruption
List
:
activate
(
failure
,
failure
.
run
())
activate
(
objectInterruption
,
objectInterruption
.
run
())
simulate
(
until
=
G
.
maxSimTime
)
#run the simulation
simulate
(
until
=
G
.
maxSimTime
)
#run the simulation
...
...
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