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
bc13e57b
Commit
bc13e57b
authored
Oct 23, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output also average buffer level
parent
c95ce840
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
dream/simulation/Examples/OperationalFailures.py
dream/simulation/Examples/OperationalFailures.py
+19
-3
No files found.
dream/simulation/Examples/OperationalFailures.py
View file @
bc13e57b
...
@@ -8,7 +8,7 @@ import time
...
@@ -8,7 +8,7 @@ import time
start
=
time
.
time
()
start
=
time
.
time
()
# simulation time
# simulation time
maxSimTime
=
10
000
maxSimTime
=
10
# the capacity of B123
# the capacity of B123
capacity
=
3
#float('inf')
capacity
=
3
#float('inf')
...
@@ -28,6 +28,17 @@ class OpQueue(Queue):
...
@@ -28,6 +28,17 @@ class OpQueue(Queue):
return
M2
return
M2
return
None
return
None
# calculate average buffer level
def
postProcessing
(
self
):
Queue
.
postProcessing
(
self
,
MaxSimtime
=
maxSimTime
)
totalBufferLevel
=
0
for
i
in
range
(
0
,
len
(
self
.
wipStatList
)
-
1
):
bufferLevel
=
self
.
wipStatList
[
i
][
1
]
duration
=
self
.
wipStatList
[
i
+
1
][
0
]
-
self
.
wipStatList
[
i
][
0
]
totalBufferLevel
+=
bufferLevel
*
duration
averageBufferLevel
=
totalBufferLevel
/
maxSimTime
self
.
BufferLevel
.
append
(
averageBufferLevel
)
class
OpExit
(
Exit
):
class
OpExit
(
Exit
):
# set numGoodParts=0 at every replication
# set numGoodParts=0 at every replication
def
initialize
(
self
):
def
initialize
(
self
):
...
@@ -166,7 +177,7 @@ NS2=NonStarvingEntry('NS2','Entry2',entityData={'_class':'Dream.Part','status':'
...
@@ -166,7 +177,7 @@ NS2=NonStarvingEntry('NS2','Entry2',entityData={'_class':'Dream.Part','status':'
M1
=
OpMachine
(
'M1'
,
'Machine1'
,
processingTime
=
{
'Fixed'
:{
'mean'
:
0.1
}})
M1
=
OpMachine
(
'M1'
,
'Machine1'
,
processingTime
=
{
'Fixed'
:{
'mean'
:
0.1
}})
M2
=
OpMachine
(
'M2'
,
'Machine2'
,
processingTime
=
{
'Fixed'
:{
'mean'
:
0.1
}})
M2
=
OpMachine
(
'M2'
,
'Machine2'
,
processingTime
=
{
'Fixed'
:{
'mean'
:
0.1
}})
M3
=
OpMachine
(
'M3'
,
'Machine3'
,
processingTime
=
{
'Fixed'
:{
'mean'
:
0.1
}})
M3
=
OpMachine
(
'M3'
,
'Machine3'
,
processingTime
=
{
'Fixed'
:{
'mean'
:
0.1
}})
B123
=
OpQueue
(
'B123'
,
'Queue'
,
capacity
=
capacity
)
B123
=
OpQueue
(
'B123'
,
'Queue'
,
capacity
=
capacity
,
gatherWipStat
=
True
)
E
=
OpExit
(
'E1'
,
'Exit'
)
E
=
OpExit
(
'E1'
,
'Exit'
)
Controller
=
EventGenerator
(
'EV'
,
'Controller'
,
start
=
0
,
interval
=
1
,
method
=
controllerMethod
)
Controller
=
EventGenerator
(
'EV'
,
'Controller'
,
start
=
0
,
interval
=
1
,
method
=
controllerMethod
)
...
@@ -193,6 +204,9 @@ E.GoodExits=[]
...
@@ -193,6 +204,9 @@ E.GoodExits=[]
for
M
in
[
M1
,
M2
,
M3
]:
for
M
in
[
M1
,
M2
,
M3
]:
M
.
GoodExits
=
[]
M
.
GoodExits
=
[]
# BufferLevel will keep the average buffer level for each replication
B123
.
BufferLevel
=
[]
# the transition probabilities for machines
# the transition probabilities for machines
M1
.
p
=
0.01
M1
.
p
=
0.01
M1
.
g
=
0.01
M1
.
g
=
0.01
...
@@ -208,15 +222,17 @@ M3.r=0.1
...
@@ -208,15 +222,17 @@ M3.r=0.1
M3
.
f
=
0.2
M3
.
f
=
0.2
# call the runSimulation giving the objects and the length of the experiment
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
,
numberOfReplications
=
20
,
trace
=
'No'
)
runSimulation
(
objectList
,
maxSimTime
,
numberOfReplications
=
1
,
trace
=
'No'
)
#print the results
#print the results
PRt
=
sum
(
E
.
Exits
)
/
float
(
len
(
E
.
Exits
))
PRt
=
sum
(
E
.
Exits
)
/
float
(
len
(
E
.
Exits
))
PRg
=
sum
(
E
.
GoodExits
)
/
float
(
len
(
E
.
GoodExits
))
PRg
=
sum
(
E
.
GoodExits
)
/
float
(
len
(
E
.
GoodExits
))
B123ABF
=
sum
(
B123
.
BufferLevel
)
/
float
(
len
(
B123
.
BufferLevel
))
print
E
.
Exits
print
E
.
Exits
print
E
.
GoodExits
print
E
.
GoodExits
print
'PRt='
,
PRt
/
float
(
maxSimTime
)
print
'PRt='
,
PRt
/
float
(
maxSimTime
)
print
'PRg='
,
PRg
/
float
(
maxSimTime
)
print
'PRg='
,
PRg
/
float
(
maxSimTime
)
print
'B123 average buffer level='
,
B123ABF
for
M
in
[
M1
,
M2
,
M3
]:
for
M
in
[
M1
,
M2
,
M3
]:
GE
=
sum
(
M
.
GoodExits
)
/
float
(
len
(
M
.
GoodExits
))
GE
=
sum
(
M
.
GoodExits
)
/
float
(
len
(
M
.
GoodExits
))
print
'PRg'
+
M
.
id
,
'='
,
GE
/
float
(
maxSimTime
)
print
'PRg'
+
M
.
id
,
'='
,
GE
/
float
(
maxSimTime
)
...
...
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