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
94b3db2d
Commit
94b3db2d
authored
Feb 21, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify some outputResultJSON
parent
d71a5c7e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
85 deletions
+46
-85
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+25
-38
dream/simulation/Machine.py
dream/simulation/Machine.py
+21
-47
No files found.
dream/simulation/Conveyer.py
View file @
94b3db2d
...
...
@@ -350,11 +350,11 @@ class Conveyer(CoreObject):
#outputs results to JSON File
def
outputResultsJSON
(
self
):
from
Globals
import
G
if
(
G
.
numberOfReplications
==
1
):
#if we had just one replication output the results to excel
json
=
{}
json
[
'_class'
]
=
'Dream.Conveyer'
;
json
[
'id'
]
=
str
(
self
.
id
)
json
[
'results'
]
=
{}
if
(
G
.
numberOfReplications
==
1
):
#if we had just one replication output the results to excel
json
[
'results'
][
'working_ratio'
]
=
100
*
self
.
totalWorkingTime
/
G
.
maxSimTime
json
[
'results'
][
'blockage_ratio'
]
=
100
*
self
.
totalBlockageTime
/
G
.
maxSimTime
json
[
'results'
][
'waiting_ratio'
]
=
100
*
self
.
totalWaitingTime
/
G
.
maxSimTime
...
...
@@ -363,37 +363,24 @@ class Conveyer(CoreObject):
#so failurePortion will be exactly the same in each run). That will give 0 variability and errors.
#so for each output value we check if there was difference in the runs' results
#if yes we output the Confidence Intervals. if not we output just the fix value
json
=
{}
json
[
'_class'
]
=
'Dream.Conveyer'
;
json
[
'id'
]
=
str
(
self
.
id
)
json
[
'results'
]
=
{}
json
[
'results'
][
'working_ratio'
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
self
.
Working
):
json
[
'results'
][
'working_ratio'
][
'min'
]
=
stat
.
bayes_mvs
(
self
.
Working
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
'working_ratio'
][
'avg'
]
=
stat
.
bayes_mvs
(
self
.
Working
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
'working_ratio'
][
'max'
]
=
stat
.
bayes_mvs
(
self
.
Working
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
else
:
json
[
'results'
][
'working_ratio'
][
'min'
]
=
self
.
Working
[
0
]
json
[
'results'
][
'working_ratio'
][
'avg'
]
=
self
.
Working
[
0
]
json
[
'results'
][
'working_ratio'
][
'max'
]
=
self
.
Working
[
0
]
json
[
'results'
][
'blockage_ratio'
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
self
.
Blockage
):
json
[
'results'
][
'blockage_ratio'
][
'min'
]
=
stat
.
bayes_mvs
(
self
.
Blockage
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
'blockage_ratio'
][
'avg'
]
=
stat
.
bayes_mvs
(
self
.
Blockage
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
'blockage_ratio'
][
'max'
]
=
stat
.
bayes_mvs
(
self
.
Blockage
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
for
ratio
,
measureList
in
(
(
'failure_ratio'
,
self
.
Failure
),
(
'working_ratio'
,
self
.
Working
),
(
'blockage_ratio'
,
self
.
Blockage
),
(
'waiting_ratio'
,
self
.
Waiting
),
):
json
[
'results'
][
ratio
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
measureList
):
json
[
'results'
][
ratio
][
'min'
]
=
stat
.
bayes_mvs
(
measureList
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
ratio
][
'avg'
]
=
stat
.
bayes_mvs
(
measureList
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
ratio
][
'max'
]
=
stat
.
bayes_mvs
(
measureList
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
else
:
json
[
'results'
][
'blockage_ratio'
][
'min'
]
=
self
.
Blockage
[
0
]
json
[
'results'
][
'blockage_ratio'
][
'avg'
]
=
self
.
Blockage
[
0
]
json
[
'results'
][
'blockage_ratio'
][
'max'
]
=
self
.
Blockage
[
0
]
json
[
'results'
][
'waiting_ratio'
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
self
.
Waiting
):
json
[
'results'
][
'waiting_ratio'
][
'min'
]
=
stat
.
bayes_mvs
(
self
.
Waiting
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
stat
.
bayes_mvs
(
self
.
Waiting
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
stat
.
bayes_mvs
(
self
.
Waiting
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
else
:
json
[
'results'
][
'waiting_ratio'
][
'min'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
ratio
][
'min'
]
=
\
json
[
'results'
][
ratio
][
'avg'
]
=
\
json
[
'results'
][
ratio
][
'max'
]
=
measureList
[
0
]
G
.
outputJSON
[
'elementList'
].
append
(
json
)
#Process that handles the moves of the conveyer
...
...
dream/simulation/Machine.py
View file @
94b3db2d
...
...
@@ -865,51 +865,25 @@ class Machine(CoreObject):
json
[
'_class'
]
=
'Dream.Machine'
;
json
[
'id'
]
=
str
(
self
.
id
)
json
[
'results'
]
=
{}
json
[
'results'
][
'failure_ratio'
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
self
.
Failure
):
json
[
'results'
][
'failure_ratio'
][
'min'
]
=
stat
.
bayes_mvs
(
self
.
Failure
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
'failure_ratio'
][
'avg'
]
=
stat
.
bayes_mvs
(
self
.
Failure
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
'failure_ratio'
][
'max'
]
=
stat
.
bayes_mvs
(
self
.
Failure
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
else
:
json
[
'results'
][
'failure_ratio'
][
'min'
]
=
self
.
Failure
[
0
]
json
[
'results'
][
'failure_ratio'
][
'avg'
]
=
self
.
Failure
[
0
]
json
[
'results'
][
'failure_ratio'
][
'max'
]
=
self
.
Failure
[
0
]
json
[
'results'
][
'working_ratio'
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
self
.
Working
):
json
[
'results'
][
'working_ratio'
][
'min'
]
=
stat
.
bayes_mvs
(
self
.
Working
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
'working_ratio'
][
'avg'
]
=
stat
.
bayes_mvs
(
self
.
Working
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
'working_ratio'
][
'max'
]
=
stat
.
bayes_mvs
(
self
.
Working
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
else
:
json
[
'results'
][
'working_ratio'
][
'min'
]
=
self
.
Working
[
0
]
json
[
'results'
][
'working_ratio'
][
'avg'
]
=
self
.
Working
[
0
]
json
[
'results'
][
'working_ratio'
][
'max'
]
=
self
.
Working
[
0
]
json
[
'results'
][
'blockage_ratio'
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
self
.
Blockage
):
json
[
'results'
][
'blockage_ratio'
][
'min'
]
=
stat
.
bayes_mvs
(
self
.
Blockage
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
'blockage_ratio'
][
'avg'
]
=
stat
.
bayes_mvs
(
self
.
Blockage
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
'blockage_ratio'
][
'max'
]
=
stat
.
bayes_mvs
(
self
.
Blockage
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
else
:
json
[
'results'
][
'blockage_ratio'
][
'min'
]
=
self
.
Blockage
[
0
]
json
[
'results'
][
'blockage_ratio'
][
'avg'
]
=
self
.
Blockage
[
0
]
json
[
'results'
][
'blockage_ratio'
][
'max'
]
=
self
.
Blockage
[
0
]
json
[
'results'
][
'waiting_ratio'
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
self
.
Waiting
):
json
[
'results'
][
'waiting_ratio'
][
'min'
]
=
stat
.
bayes_mvs
(
self
.
Waiting
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
stat
.
bayes_mvs
(
self
.
Waiting
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
stat
.
bayes_mvs
(
self
.
Waiting
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
else
:
json
[
'results'
][
'waiting_ratio'
][
'min'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'off_shifts_ratio'
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
self
.
OffShift
):
json
[
'results'
][
'off_shifts_ratio'
][
'min'
]
=
stat
.
bayes_mvs
(
self
.
OffShift
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
'off_shifts_ratio'
][
'avg'
]
=
stat
.
bayes_mvs
(
self
.
OffShift
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
'off_shifts_ratio'
][
'max'
]
=
stat
.
bayes_mvs
(
self
.
OffShift
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
for
ratio
,
measureList
in
(
(
'failure_ratio'
,
self
.
Failure
),
(
'working_ratio'
,
self
.
Working
),
(
'blockage_ratio'
,
self
.
Blockage
),
(
'waiting_ratio'
,
self
.
Waiting
),
(
'off_shift_ratio'
,
self
.
OffShift
),
):
json
[
'results'
][
ratio
]
=
{}
if
self
.
checkIfArrayHasDifValues
(
measureList
):
json
[
'results'
][
ratio
][
'min'
]
=
stat
.
bayes_mvs
(
measureList
,
G
.
confidenceLevel
)[
0
][
1
][
0
]
json
[
'results'
][
ratio
][
'avg'
]
=
stat
.
bayes_mvs
(
measureList
,
G
.
confidenceLevel
)[
0
][
0
]
json
[
'results'
][
ratio
][
'max'
]
=
stat
.
bayes_mvs
(
measureList
,
G
.
confidenceLevel
)[
0
][
1
][
1
]
else
:
json
[
'results'
][
'off_shifts_ratio'
][
'min'
]
=
self
.
OffShift
[
0
]
json
[
'results'
][
'off_shifts_ratio'
][
'avg'
]
=
self
.
OffShift
[
0
]
json
[
'results'
][
'off_shifts_ratio'
][
'max'
]
=
self
.
OffShift
[
0
]
json
[
'results'
][
ratio
][
'min'
]
=
\
json
[
'results'
][
ratio
][
'avg'
]
=
\
json
[
'results'
][
ratio
][
'max'
]
=
measureList
[
0
]
G
.
outputJSON
[
'elementList'
].
append
(
json
)
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