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
00b79844
Commit
00b79844
authored
Oct 15, 2013
by
Georgios Dagkakis
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
documentation updated with examples. also code refined in some places and older documents removed
parent
73cfd6a0
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
384 additions
and
37 deletions
+384
-37
ManPy_documentation.doc
ManPy_documentation.doc
+0
-0
dream/simulation/Assembly.py
dream/simulation/Assembly.py
+7
-7
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+7
-8
dream/simulation/Examples/AssemblyLine.py
dream/simulation/Examples/AssemblyLine.py
+49
-0
dream/simulation/Examples/ParallelServers1.py
dream/simulation/Examples/ParallelServers1.py
+48
-0
dream/simulation/Examples/ParallelServers2.py
dream/simulation/Examples/ParallelServers2.py
+66
-0
dream/simulation/Examples/ParallelServers3.py
dream/simulation/Examples/ParallelServers3.py
+85
-0
dream/simulation/Examples/SingleServer.py
dream/simulation/Examples/SingleServer.py
+7
-16
dream/simulation/Examples/TwoServers.py
dream/simulation/Examples/TwoServers.py
+51
-0
dream/simulation/Examples/TwoServersStochastic.py
dream/simulation/Examples/TwoServersStochastic.py
+58
-0
dream/simulation/Frame.py
dream/simulation/Frame.py
+2
-2
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+2
-2
dream/simulation/Machine.py
dream/simulation/Machine.py
+1
-1
dream/simulation/Repairman.py
dream/simulation/Repairman.py
+1
-1
dream/simulation/documents/ClassHierarchy.png
dream/simulation/documents/ClassHierarchy.png
+0
-0
dream/simulation/documents/List of elements and conventions.doc
...simulation/documents/List of elements and conventions.doc
+0
-0
dream/simulation/documents/Objectives and philosophy.doc
dream/simulation/documents/Objectives and philosophy.doc
+0
-0
No files found.
ManPy_documentation.doc
View file @
00b79844
No preview for this file type
dream/simulation/Assembly.py
View file @
00b79844
...
...
@@ -37,17 +37,17 @@ from CoreObject import CoreObject
class
Assembly
(
CoreObject
):
#initialize the object
def
__init__
(
self
,
id
,
name
,
dist
,
time
):
def
__init__
(
self
,
id
,
name
,
dist
ribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0.1
,
min
=
0
,
max
=
5
):
Process
.
__init__
(
self
)
self
.
id
=
id
self
.
objName
=
name
self
.
type
=
"Assembly"
#String that shows the type of object
self
.
distType
=
dist
#the distribution that the procTime follows
self
.
distType
=
dist
ribution
#the distribution that the procTime follows
self
.
rng
=
RandomNumberGenerator
(
self
,
self
.
distType
)
self
.
rng
.
avg
=
time
[
0
]
self
.
rng
.
stdev
=
time
[
1
]
self
.
rng
.
min
=
time
[
2
]
self
.
rng
.
max
=
time
[
3
]
self
.
rng
.
avg
=
mean
self
.
rng
.
stdev
=
stdev
self
.
rng
.
min
=
min
self
.
rng
.
max
=
max
self
.
next
=
[]
#list with the next objects in the flow
self
.
previous
=
[]
#list with the previous objects in the flow
self
.
previousPart
=
[]
#list with the previous objects that send parts
...
...
@@ -107,7 +107,7 @@ class Assembly(CoreObject):
#and one "frame" predecessor requests it
self
.
getEntity
(
"Frame"
)
#get the Frame
for
i
in
range
(
self
.
Res
.
activeQ
[
0
].
numOfParts
):
#this loop will be carried until the Frame is full with the parts
for
i
in
range
(
self
.
Res
.
activeQ
[
0
].
capacity
):
#this loop will be carried until the Frame is full with the parts
yield
waituntil
,
self
,
self
.
isRequestedFromPart
#wait until a part is requesting for the assembly
self
.
getEntity
(
"Part"
)
...
...
dream/simulation/Dismantle.py
View file @
00b79844
...
...
@@ -38,16 +38,16 @@ from CoreObject import CoreObject
class
Dismantle
(
CoreObject
):
#initialize the object
def
__init__
(
self
,
id
,
name
,
dist
,
time
):
def
__init__
(
self
,
id
,
name
,
dist
ribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0.1
,
min
=
0
,
max
=
5
):
self
.
id
=
id
self
.
objName
=
name
self
.
type
=
"Dismantle"
#String that shows the type of object
self
.
distType
=
dist
#the distribution that the procTime follows
self
.
distType
=
dist
ribution
#the distribution that the procTime follows
self
.
rng
=
RandomNumberGenerator
(
self
,
self
.
distType
)
self
.
rng
.
avg
=
time
[
0
]
self
.
rng
.
stdev
=
time
[
1
]
self
.
rng
.
min
=
time
[
2
]
self
.
rng
.
max
=
time
[
3
]
self
.
rng
.
avg
=
mean
self
.
rng
.
stdev
=
stdev
self
.
rng
.
min
=
min
self
.
rng
.
max
=
max
self
.
previous
=
[]
#list with the previous objects in the flow
self
.
previousIds
=
[]
#list with the ids of the previous objects in the flow
self
.
nextPart
=
[]
#list with the next objects that receive parts
...
...
@@ -164,8 +164,7 @@ class Dismantle(CoreObject):
self
.
Res
.
activeQ
.
append
(
self
.
previous
[
0
].
Res
.
activeQ
[
0
])
#get the frame from the predecessor
self
.
previous
[
0
].
removeEntity
()
#append also the parts in the res so that they can be popped
for
i
in
range
(
self
.
Res
.
activeQ
[
0
].
numOfParts
):
#self.Res.activeQ.append(self.Res.activeQ[0].Res.activeQ[self.Res.activeQ[0].numOfParts-1-i])
for
i
in
range
(
self
.
Res
.
activeQ
[
0
].
capacity
):
self
.
Res
.
activeQ
.
append
(
self
.
Res
.
activeQ
[
0
].
Res
.
activeQ
[
i
])
self
.
Res
.
activeQ
[
0
].
Res
.
activeQ
=
[]
self
.
Res
.
activeQ
.
append
(
self
.
Res
.
activeQ
[
0
])
...
...
dream/simulation/Examples/AssemblyLine.py
0 → 100644
View file @
00b79844
from
SimPy.Simulation
import
simulate
,
activate
,
initialize
from
simulation.Machine
import
Machine
from
simulation.Source
import
Source
from
simulation.Exit
import
Exit
from
simulation.Part
import
Part
from
simulation.Frame
import
Frame
from
simulation.Assembly
import
Assembly
from
simulation.Globals
import
G
#define the objects of the model
Frame
.
capacity
=
4
Sp
=
Source
(
'SP'
,
'Parts'
,
mean
=
0.5
,
item
=
Part
)
Sf
=
Source
(
'SF'
,
'Frames'
,
mean
=
2
,
item
=
Frame
)
M
=
Machine
(
'M'
,
'Machine'
,
mean
=
0.25
,
failureDistribution
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
A
=
Assembly
(
'A'
,
'Assembly'
,
mean
=
2
)
E
=
Exit
(
'E1'
,
'Exit'
)
G
.
ObjList
=
[
Sp
,
Sf
,
M
,
A
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
Sp
.
defineRouting
([
A
])
Sf
.
defineRouting
([
A
])
A
.
defineRouting
([
Sp
,
Sf
],[
M
])
M
.
defineRouting
([
A
],[
E
])
E
.
defineRouting
([
M
])
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
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
simulate
(
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
(
G
.
maxSimTime
)
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"frames"
print
"the working ratio of"
,
A
.
objName
,
"is"
,
(
A
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
,
"%"
dream/simulation/Examples/ParallelServers1.py
0 → 100644
View file @
00b79844
from
SimPy.Simulation
import
simulate
,
activate
,
initialize
,
infinity
from
simulation.Machine
import
Machine
from
simulation.Queue
import
Queue
from
simulation.Source
import
Source
from
simulation.Exit
import
Exit
from
simulation.Part
import
Part
from
simulation.Globals
import
G
#define the objects of the model
S
=
Source
(
'S'
,
'Source'
,
mean
=
0.5
,
item
=
Part
)
Q
=
Queue
(
'Q'
,
'Queue'
,
capacity
=
infinity
)
M1
=
Machine
(
'M1'
,
'Milling1'
,
mean
=
0.25
,
failureDistribution
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
M2
=
Machine
(
'M2'
,
'Milling2'
,
mean
=
0.25
)
E
=
Exit
(
'E1'
,
'Exit'
)
G
.
ObjList
=
[
S
,
Q
,
M1
,
M2
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
S
.
defineRouting
([
Q
])
Q
.
defineRouting
([
S
],[
M1
,
M2
])
M1
.
defineRouting
([
Q
],[
E
])
M2
.
defineRouting
([
Q
],[
E
])
E
.
defineRouting
([
M1
,
M2
])
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
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
simulate
(
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
(
G
.
maxSimTime
)
#print the results
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"
,
M2
.
objName
,
"is"
,
(
M2
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
,
"%"
dream/simulation/Examples/ParallelServers2.py
0 → 100644
View file @
00b79844
from
SimPy.Simulation
import
simulate
,
activate
,
initialize
,
infinity
from
simulation.Machine
import
Machine
from
simulation.Queue
import
Queue
from
simulation.Source
import
Source
from
simulation.Exit
import
Exit
from
simulation.Part
import
Part
from
simulation.Globals
import
G
#the custom queue
class
SelectiveQueue
(
Queue
):
def
haveToDispose
(
self
,
callerObject
=
None
):
caller
=
callerObject
#if the caller is Milling1 then we return true if there are parts queued
if
caller
.
id
==
'M1'
:
return
len
(
self
.
getActiveObjectQueue
())
>
0
#if the caller is Milling2 then we have to check Milling1's condition.
#we return true if there are parts queued AND Milling1 cannot accept them
self
.
M1
=
None
if
caller
.
id
==
'M2'
:
#loop through the objects to identify Milling1
for
object
in
G
.
ObjList
:
if
object
.
id
==
'M1'
:
self
.
M1
=
object
#check Queue's status and also if Milling1 can accept
return
len
(
self
.
getActiveObjectQueue
())
>
0
and
(
not
(
self
.
M1
.
canAccept
()))
#define the objects of the model
S
=
Source
(
'S'
,
'Source'
,
mean
=
0.5
,
item
=
Part
)
Q
=
SelectiveQueue
(
'Q'
,
'Queue'
,
capacity
=
infinity
)
#Q is now of type SelectiveQueue
M1
=
Machine
(
'M1'
,
'Milling1'
,
mean
=
0.25
,
failureDistribution
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
M2
=
Machine
(
'M2'
,
'Milling2'
,
mean
=
0.25
)
E
=
Exit
(
'E1'
,
'Exit'
)
G
.
ObjList
=
[
S
,
Q
,
M1
,
M2
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
S
.
defineRouting
([
Q
])
Q
.
defineRouting
([
S
],[
M1
,
M2
])
M1
.
defineRouting
([
Q
],[
E
])
M2
.
defineRouting
([
Q
],[
E
])
E
.
defineRouting
([
M1
,
M2
])
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
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
simulate
(
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
(
G
.
maxSimTime
)
#print the results
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"
,
M2
.
objName
,
"is"
,
(
M2
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
,
"%"
dream/simulation/Examples/ParallelServers3.py
0 → 100644
View file @
00b79844
from
SimPy.Simulation
import
simulate
,
activate
,
initialize
,
infinity
,
now
from
simulation.Machine
import
Machine
from
simulation.Queue
import
Queue
from
simulation.Source
import
Source
from
simulation.Exit
import
Exit
from
simulation.Part
import
Part
from
simulation.Globals
import
G
#the custom queue
class
SelectiveQueue
(
Queue
):
def
haveToDispose
(
self
,
callerObject
=
None
):
caller
=
callerObject
if
caller
.
id
==
'M1'
:
return
len
(
self
.
getActiveObjectQueue
())
>
0
self
.
M1
=
None
if
caller
.
id
==
'M2'
:
for
object
in
G
.
ObjList
:
if
object
.
id
==
'M1'
:
self
.
M1
=
object
return
len
(
self
.
getActiveObjectQueue
())
>
0
and
(
not
(
self
.
M1
.
canAccept
()))
#the custom machine
class
Milling
(
Machine
):
def
getEntity
(
self
):
Machine
.
getEntity
(
self
)
#call the parent method to get the entity
part
=
self
.
getActiveObjectQueue
()[
0
]
#retrieve the obtained part
part
.
machineId
=
self
.
id
#create an attribute to the obtained part and give it the value of the object's id
#the custom exit
class
CountingExit
(
Exit
):
def
getEntity
(
self
):
part
=
self
.
getGiverObjectQueue
()[
0
]
#find the part to be obtained
Exit
.
getEntity
(
self
)
#call the parent method to get the entity
#check the attribute and update the counters accordingly
if
part
.
machineId
==
'M1'
:
G
.
NumM1
+=
1
elif
part
.
machineId
==
'M2'
:
G
.
NumM2
+=
1
#define the objects of the model
S
=
Source
(
'S'
,
'Source'
,
mean
=
0.5
,
item
=
Part
)
Q
=
SelectiveQueue
(
'Q'
,
'Queue'
,
capacity
=
infinity
)
M1
=
Milling
(
'M1'
,
'Milling1'
,
mean
=
0.25
,
failureDistribution
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
)
M2
=
Milling
(
'M2'
,
'Milling2'
,
mean
=
0.25
)
E
=
CountingExit
(
'E1'
,
'Exit'
)
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
.
NumM1
=
0
G
.
NumM2
=
0
#define predecessors and successors for the objects
S
.
defineRouting
([
Q
])
Q
.
defineRouting
([
S
],[
M1
,
M2
])
M1
.
defineRouting
([
Q
],[
E
])
M2
.
defineRouting
([
Q
],[
E
])
E
.
defineRouting
([
M1
,
M2
])
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
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
simulate
(
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
(
G
.
maxSimTime
)
#print the results
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"
,
M2
.
objName
,
"is"
,
(
M2
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
,
"%"
print
M1
.
objName
,
"produced"
,
G
.
NumM1
,
"parts"
print
M2
.
objName
,
"produced"
,
G
.
NumM2
,
"parts"
dream/simulation/Examples/
Example01
.py
→
dream/simulation/Examples/
SingleServer
.py
View file @
00b79844
'''
Created on 14 Oct 2013
@author: George
'''
from
SimPy.Simulation
import
simulate
,
activate
,
initialize
from
dream.simulation.Machine
import
Machine
from
dream.simulation.Source
import
Source
from
dream.simulation.Exit
import
Exit
from
dream.simulation.Part
import
Part
from
dream.simulation.Globals
import
G
from
dream.simulation.Entity
import
Entity
from
dream.simulation.CoreObject
import
CoreObject
from
random
import
Random
from
simulation.Machine
import
Machine
from
simulation.Source
import
Source
from
simulation.Exit
import
Exit
from
simulation.Part
import
Part
from
simulation.Globals
import
G
#define the objects of the model
S
=
Source
(
'S1'
,
'Source'
,
distribution
=
'Fixed'
,
mean
=
0.5
,
item
=
Part
)
M
=
Machine
(
'M1'
,
'Machine'
,
distribution
=
'Fixed'
,
mean
=
0.25
)
M
=
Machine
(
'M1'
,
'Machine'
,
mean
=
0.25
)
E
=
Exit
(
'E1'
,
'Exit'
)
G
.
ObjList
=
[
S
,
M
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
...
...
@@ -46,4 +37,4 @@ for object in G.ObjList:
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
print
"the total working ratio
n
of the Machine is"
,
(
M
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
,
"%"
print
"the total working ratio of the Machine is"
,
(
M
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
,
"%"
dream/simulation/Examples/TwoServers.py
0 → 100644
View file @
00b79844
from
SimPy.Simulation
import
simulate
,
activate
,
initialize
from
simulation.Machine
import
Machine
from
simulation.Source
import
Source
from
simulation.Exit
import
Exit
from
simulation.Part
import
Part
from
simulation.Repairman
import
Repairman
from
simulation.Queue
import
Queue
from
simulation.Globals
import
G
#define the objects of the model
R
=
Repairman
(
'R1'
,
'Bob'
)
S
=
Source
(
'S1'
,
'Source'
,
mean
=
0.5
,
item
=
Part
)
M1
=
Machine
(
'M1'
,
'Machine1'
,
mean
=
0.25
,
failureDistribution
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
,
repairman
=
R
)
Q
=
Queue
(
'Q1'
,
'Queue'
)
M2
=
Machine
(
'M2'
,
'Machine2'
,
mean
=
1.5
,
failureDistribution
=
'Fixed'
,
MTTF
=
40
,
MTTR
=
10
,
repairman
=
R
)
E
=
Exit
(
'E1'
,
'Exit'
)
G
.
ObjList
=
[
S
,
M1
,
M2
,
E
,
Q
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
S
.
defineRouting
([
M1
])
M1
.
defineRouting
([
S
],[
Q
])
Q
.
defineRouting
([
M1
],[
M2
])
M2
.
defineRouting
([
Q
],[
E
])
E
.
defineRouting
([
M2
])
initialize
()
#initialize the simulation (SimPy method)
#initialize all the objects
R
.
initialize
()
for
object
in
G
.
ObjList
:
object
.
initialize
()
#activate all the objects
for
object
in
G
.
ObjList
:
activate
(
object
,
object
.
run
())
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
simulate
(
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
(
G
.
maxSimTime
)
R
.
postProcessing
(
G
.
maxSimTime
)
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
print
"the blockage ratio of"
,
M1
.
objName
,
"is"
,
(
M1
.
totalBlockageTime
/
G
.
maxSimTime
)
*
100
,
"%"
print
"the working ratio of"
,
R
.
objName
,
"is"
,
(
R
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
,
"%"
\ No newline at end of file
dream/simulation/Examples/TwoServersStochastic.py
0 → 100644
View file @
00b79844
from
SimPy.Simulation
import
simulate
,
activate
,
initialize
from
simulation.Machine
import
Machine
from
simulation.Source
import
Source
from
simulation.Exit
import
Exit
from
simulation.Part
import
Part
from
simulation.Repairman
import
Repairman
from
simulation.Queue
import
Queue
from
simulation.Globals
import
G
#define the objects of the model
R
=
Repairman
(
'R1'
,
'Bob'
)
S
=
Source
(
'S1'
,
'Source'
,
mean
=
0.5
,
item
=
Part
)
M1
=
Machine
(
'M1'
,
'Machine1'
,
distribution
=
'Normal'
,
mean
=
0.25
,
stdev
=
0.1
,
min
=
0.1
,
max
=
1
,
failureDistribution
=
'Fixed'
,
MTTF
=
60
,
MTTR
=
5
,
repairman
=
R
)
Q
=
Queue
(
'Q1'
,
'Queue'
)
M2
=
Machine
(
'M2'
,
'Machine2'
,
distribution
=
'Normal'
,
mean
=
1.5
,
stdev
=
0.3
,
min
=
0.5
,
max
=
5
,
failureDistribution
=
'Fixed'
,
MTTF
=
40
,
MTTR
=
10
,
repairman
=
R
)
E
=
Exit
(
'E1'
,
'Exit'
)
G
.
ObjList
=
[
S
,
M1
,
M2
,
E
,
Q
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
S
.
defineRouting
([
M1
])
M1
.
defineRouting
([
S
],[
Q
])
Q
.
defineRouting
([
M1
],[
M2
])
M2
.
defineRouting
([
Q
],[
E
])
E
.
defineRouting
([
M2
])
G
.
maxSimTime
=
1440.0
#set G.maxSimTime 1440.0 minutes (1 day)
G
.
numberOfReplications
=
10
#set 10 replications
G
.
confidenceLevel
=
0.99
#set the confidence level. 0.99=99%
#run the replications
for
i
in
range
(
G
.
numberOfReplications
):
G
.
seed
+=
1
#increment the seed so that we get different random numbers in each run.
initialize
()
#initialize the simulation (SimPy method)
#initialize all the objects
R
.
initialize
()
for
object
in
G
.
ObjList
:
object
.
initialize
()
#activate all the objects
for
object
in
G
.
ObjList
:
activate
(
object
,
object
.
run
())
simulate
(
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
(
G
.
maxSimTime
)
R
.
postProcessing
(
G
.
maxSimTime
)
#output data to excel for every object
for
object
in
G
.
ObjList
:
object
.
outputResultsXL
(
G
.
maxSimTime
)
R
.
outputResultsXL
(
G
.
maxSimTime
)
G
.
outputFile
.
save
(
"output.xls"
)
dream/simulation/Frame.py
View file @
00b79844
...
...
@@ -33,12 +33,12 @@ from Entity import Entity
#The entity object
class
Frame
(
Entity
):
type
=
"Frame"
numOfParts
=
4
#the number of parts that the frame can take
capacity
=
4
#the number of parts that the frame can take
def
__init__
(
self
,
name
):
Entity
.
__init__
(
self
,
name
)
self
.
Res
=
Resource
(
self
.
numOfParts
)
self
.
Res
=
Resource
(
self
.
capacity
)
#dimension data
self
.
width
=
2.0
self
.
height
=
2.0
...
...
dream/simulation/LineGenerationJSON.py
View file @
00b79844
...
...
@@ -260,7 +260,7 @@ def createObjects():
stdev
=
float
(
processingTime
.
get
(
'stdev'
,
'0'
))
min
=
float
(
processingTime
.
get
(
'min'
,
'0'
))
max
=
float
(
processingTime
.
get
(
'max'
,
'0'
))
A
=
Assembly
(
id
,
name
,
distribution
Type
,
[
mean
,
stdev
,
min
,
max
]
)
A
=
Assembly
(
id
,
name
,
distribution
=
distributionType
,
mean
=
mean
,
stdev
=
stdev
,
min
=
min
,
max
=
max
)
A
.
nextIds
=
getSuccessorList
(
id
)
G
.
AssemblyList
.
append
(
A
)
G
.
ObjList
.
append
(
A
)
...
...
@@ -274,7 +274,7 @@ def createObjects():
stdev
=
float
(
processingTime
.
get
(
'stdev'
,
'0'
))
min
=
float
(
processingTime
.
get
(
'min'
,
'0'
))
max
=
float
(
processingTime
.
get
(
'max'
,
'0'
))
D
=
Dismantle
(
id
,
name
,
distribution
Type
,
[
mean
,
stdev
,
min
,
max
]
)
D
=
Dismantle
(
id
,
name
,
distribution
=
distributionType
,
mean
=
mean
,
stdev
=
stdev
,
min
=
min
,
max
=
max
)
D
.
nextPartIds
=
getSuccessorList
(
id
,
lambda
source
,
destination
,
edge_data
:
edge_data
.
get
(
'entity'
)
==
'Part'
)
D
.
nextFrameIds
=
getSuccessorList
(
id
,
lambda
source
,
destination
,
edge_data
:
edge_data
.
get
(
'entity'
)
==
'Frame'
)
D
.
nextIds
=
getSuccessorList
(
id
)
...
...
dream/simulation/Machine.py
View file @
00b79844
...
...
@@ -38,7 +38,7 @@ import scipy.stats as stat
class
Machine
(
CoreObject
):
#initialize the id the capacity, of the resource and the distribution
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
distribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0
,
min
=
0
,
max
=
10
,
failureDistribution
=
'No'
,
MTTF
=
0
,
MTTR
=
0
,
availability
=
0
,
repairman
=
None
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
distribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0
,
min
=
0
,
max
=
10
,
failureDistribution
=
'No'
,
MTTF
=
0
,
MTTR
=
0
,
availability
=
0
,
repairman
=
'None'
):
Process
.
__init__
(
self
)
self
.
predecessorIndex
=
0
#holds the index of the predecessor from which the Machine will take an entity next
self
.
successorIndex
=
0
#holds the index of the successor where the Machine will dispose an entity next
...
...
dream/simulation/Repairman.py
View file @
00b79844
...
...
@@ -34,7 +34,7 @@ from ObjectResource import ObjectResource
#the resource that repairs the machines
class
Repairman
(
ObjectResource
):
def
__init__
(
self
,
id
,
name
,
capacity
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
):
self
.
id
=
id
self
.
objName
=
name
self
.
capacity
=
capacity
#repairman is an instance of resource
...
...
dream/simulation/documents/ClassHierarchy.png
deleted
100644 → 0
View file @
73cfd6a0
50.2 KB
dream/simulation/documents/List of elements and conventions.doc
deleted
100644 → 0
View file @
73cfd6a0
File deleted
dream/simulation/documents/Objectives and philosophy.doc
deleted
100644 → 0
View file @
73cfd6a0
File deleted
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