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
56833666
Commit
56833666
authored
Feb 23, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
method to create a dict to post process results added
parent
643d8c93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
33 deletions
+31
-33
dream/plugins/BatchesTabularQueues.py
dream/plugins/BatchesTabularQueues.py
+31
-33
No files found.
dream/plugins/BatchesTabularQueues.py
View file @
56833666
...
...
@@ -8,50 +8,48 @@ import xlrd
from
dream.plugins
import
plugin
class
DefaultTabularExit
(
plugin
.
OutputPreparationPlugin
):
class
BatchesTabularQueues
(
plugin
.
OutputPreparationPlugin
):
""" Output the exit stats in a tab
"""
def
postprocess
(
self
,
data
):
numberOfReplications
=
int
(
data
[
'general'
][
'numberOfReplications'
])
confidenceLevel
=
float
(
data
[
'general'
][
'confidenceLevel'
])
maxSimTime
=
float
(
data
[
'general'
][
'maxSimTime'
])
if
numberOfReplications
==
1
:
# create the titles of the columns
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
]
=
[[
'Exit Id'
,
'Throughput'
,
'Takt Time'
,
'Lifespan'
]]
data
[
'result'
][
'result_list'
][
-
1
][
'buffer_output'
]
=
[[
'Buffer'
,
'Final Value'
,
'Average'
,
'Std Dev'
,
'Min'
,
'Max'
,]]
# loop the results and search for elements that have 'Exit' as family
for
record
in
data
[
'result'
][
'result_list'
][
0
][
'elementList'
]:
for
record
in
data
[
'result'
][
'result_list'
][
-
1
][
'elementList'
]:
family
=
record
.
get
(
'family'
,
None
)
# when found, add a row with the results of the specific exit
if
family
==
'Exit'
:
exitId
=
record
[
'id'
]
throughput
=
record
[
'results'
].
get
(
'throughput'
,
'undefined'
)
taktTime
=
record
[
'results'
].
get
(
'takt_time'
,
'undefined'
)
lifespan
=
record
[
'results'
].
get
(
'lifespan'
,
'undefined'
)
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
].
append
([
exitId
,
throughput
,
taktTime
,
lifespan
])
if
family
==
'Buffer'
:
bufferId
=
record
[
'id'
]
wip_stat_list
=
record
[
'results'
][
'wip_stat_list'
][
0
]
bufferLevels
=
[
int
(
x
[
1
])
for
x
in
wip_stat_list
]
minLevel
=
min
(
bufferLevels
)
maxLevel
=
max
(
bufferLevels
)
self
.
createTimeListDict
(
wip_stat_list
,
maxSimTime
)
elif
numberOfReplications
>
1
:
# create the titles of the columns
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
]
=
[[
'Exit Id'
,
''
,
'Throughput'
,
''
,
''
,
'Takt Time'
,
''
,
''
,
'Lifespan'
,
''
],
[
''
,
'LB'
,
'AVG'
,
'RB'
,
'LB'
,
'AVG'
,
'RB'
,
'LB'
,
'AVG'
,
'RB'
]]
for
record
in
data
[
'result'
][
'result_list'
][
0
][
'elementList'
]:
family
=
record
.
get
(
'family'
,
None
)
# when found, add a row with the results of the specific exit
if
family
==
'Exit'
:
exitId
=
record
[
'id'
]
throughput
=
self
.
getConfidenceInterval
(
record
[
'results'
].
get
(
'throughput'
,
'undefined'
),
confidenceLevel
)
taktTime
=
self
.
getConfidenceInterval
(
record
[
'results'
].
get
(
'takt_time'
,
'undefined'
),
confidenceLevel
)
lifespan
=
self
.
getConfidenceInterval
(
record
[
'results'
].
get
(
'lifespan'
,
'undefined'
),
confidenceLevel
)
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
].
append
([
exitId
,
throughput
[
'lb'
],
throughput
[
'avg'
],
throughput
[
'ub'
],
taktTime
[
'lb'
],
taktTime
[
'avg'
],
taktTime
[
'ub'
],
lifespan
[
'lb'
],
lifespan
[
'avg'
],
lifespan
[
'ub'
]])
pass
return
data
def
getConfidenceInterval
(
self
,
value_list
,
confidenceLevel
):
from
dream.KnowledgeExtraction.ConfidenceIntervals
import
Intervals
from
dream.KnowledgeExtraction.StatisticalMeasures
import
BasicStatisticalMeasures
BSM
=
BasicStatisticalMeasures
()
lb
,
ub
=
Intervals
().
ConfidIntervals
(
value_list
,
confidenceLevel
)
return
{
'lb'
:
lb
,
'ub'
:
ub
,
'avg'
:
BSM
.
mean
(
value_list
)
}
\ No newline at end of file
# takes the time list that ManPy outputs and creates a dict so that it is easier to get avg etc
def
createTimeListDict
(
self
,
timeList
,
maxSimTime
):
timeListDict
=
{}
i
=
0
for
record
in
timeList
:
time
=
record
[
0
]
level
=
int
(
record
[
1
])
try
:
nextTime
=
timeList
[
i
+
1
][
0
]
except
IndexError
:
nextTime
=
maxSimTime
i
+=
1
if
not
(
level
in
timeListDict
.
keys
()):
timeListDict
[
level
]
=
0
timeListDict
[
level
]
+=
nextTime
-
time
print
timeListDict
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