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
5aec2254
Commit
5aec2254
authored
Feb 25, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Plain Diff
merged changes
parents
19ecf7d2
3ce1606c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
173 additions
and
20 deletions
+173
-20
dream/plugins/BatchesOperatorGantt.py
dream/plugins/BatchesOperatorGantt.py
+67
-0
dream/plugins/BatchesOperatorUtilization.py
dream/plugins/BatchesOperatorUtilization.py
+63
-0
dream/plugins/BatchesTabularExit.py
dream/plugins/BatchesTabularExit.py
+8
-1
dream/plugins/ReadSkilledOperators.py
dream/plugins/ReadSkilledOperators.py
+11
-9
dream/simulation/Examples/GUI_instances/BatchAllInOneEmpty.json
...simulation/Examples/GUI_instances/BatchAllInOneEmpty.json
+24
-10
No files found.
dream/plugins/BatchesOperatorGantt.py
0 → 100644
View file @
5aec2254
from
datetime
import
datetime
import
random
from
pprint
import
pformat
from
dream.plugins
import
plugin
from
dream.plugins.TimeSupport
import
TimeSupportMixin
import
datetime
class
BatchesOperatorGantt
(
plugin
.
OutputPreparationPlugin
,
TimeSupportMixin
):
def
postprocess
(
self
,
data
):
"""Post process the data for Gantt gadget
"""
strptime
=
datetime
.
datetime
.
strptime
# read the current date and define dateFormat from it
try
:
now
=
strptime
(
data
[
'general'
][
'currentDate'
],
'%Y/%m/%d %H:%M'
)
data
[
'general'
][
'dateFormat'
]
=
'%Y/%m/%d %H:%M'
except
ValueError
:
now
=
strptime
(
data
[
'general'
][
'currentDate'
],
'%Y/%m/%d'
)
data
[
'general'
][
'dateFormat'
]
=
'%Y/%m/%d'
maxSimTime
=
data
[
'general'
][
'maxSimTime'
]
self
.
initializeTimeSupport
(
data
)
date_format
=
'%d-%m-%Y %H:%M'
resultElements
=
data
[
'result'
][
'result_list'
][
-
1
][
'elementList'
]
task_dict
=
{}
# loop in the results to find Operators
for
element
in
resultElements
:
if
element
[
'_class'
]
==
"Dream.Operator"
:
operatorId
=
element
[
'id'
]
# add the operator in the task_dict
task_dict
[
element
[
'id'
]]
=
dict
(
id
=
operatorId
,
text
=
operatorId
,
type
=
'operator'
,
open
=
False
)
k
=
1
for
record
in
schedule
:
entranceTime
=
record
[
'entranceTime'
]
try
:
exitTime
=
schedule
[
k
][
'entranceTime'
]
except
IndexError
:
exitTime
=
maxSimTime
k
+=
1
task_dict
[
operatorId
+
record
[
'stationId'
]
+
str
(
k
)]
=
dict
(
id
=
operatorId
+
record
[
'stationId'
]
+
str
(
k
),
parent
=
operatorId
,
text
=
record
[
'stationId'
],
start_date
=
self
.
convertToRealWorldTime
(
entranceTime
).
strftime
(
date_format
),
stop_date
=
self
.
convertToRealWorldTime
(
exitTime
).
strftime
(
date_format
),
open
=
False
,
entranceTime
=
entranceTime
,
duration
=
exitTime
-
entranceTime
,
)
# return the result to the gadget
result
=
data
[
'result'
][
'result_list'
][
-
1
]
result
[
self
.
configuration_dict
[
'output_id'
]]
=
dict
(
time_unit
=
self
.
getTimeUnitText
(),
task_list
=
sorted
(
task_dict
.
values
(),
key
=
lambda
task
:
(
task
.
get
(
'parent'
),
task
.
get
(
'type'
)
==
'project'
,
task
.
get
(
'entranceTime'
),
task
.
get
(
'id'
))))
return
data
dream/plugins/BatchesOperatorUtilization.py
0 → 100644
View file @
5aec2254
from
dream.plugins
import
plugin
from
copy
import
copy
class
BatchesOperatorUtilization
(
plugin
.
OutputPreparationPlugin
):
""" Output the station utilization metrics in a format compatible with
"""
def
postprocess
(
self
,
data
):
result
=
data
[
'result'
][
'result_list'
][
-
1
]
ticks
=
[]
working_data
=
[]
waiting_data
=
[]
off_shift_data
=
[]
options
=
{
"xaxis"
:
{
"minTickSize"
:
1
,
"ticks"
:
ticks
},
"yaxis"
:
{
"max"
:
100
},
"series"
:
{
"bars"
:
{
"show"
:
True
,
"barWidth"
:
0.8
,
"align"
:
"center"
},
"stack"
:
True
}
}
series
=
[{
"label"
:
"Working"
,
"data"
:
working_data
},
{
"label"
:
"Waiting"
,
"data"
:
waiting_data
},
{
"label"
:
"Off_shift"
,
"data"
:
off_shift_data
}];
out
=
result
[
self
.
configuration_dict
[
'output_id'
]]
=
{
"series"
:
series
,
"options"
:
options
}
i
=
0
for
obj
in
result
[
'elementList'
]:
if
obj
.
get
(
'_class'
)
==
'Dream.Operator'
:
if
obj
[
'results'
][
'working_ratio'
]:
working_data
.
append
((
i
,
obj
[
'results'
][
'working_ratio'
][
0
]))
if
obj
[
'results'
][
'waiting_ratio'
]:
waiting_data
.
append
((
i
,
obj
[
'results'
][
'waiting_ratio'
][
0
]))
if
obj
[
'results'
][
'off_shift_ratio'
]:
off_shift_data
.
append
((
i
,
obj
[
'results'
][
'off_shift_ratio'
][
0
]))
ticks
.
append
((
i
,
obj
.
get
(
'name'
,
self
.
getNameFromId
(
data
,
obj
[
'id'
]))))
i
+=
1
return
data
dream/plugins/BatchesTabularExit.py
View file @
5aec2254
...
...
@@ -29,7 +29,11 @@ class BatchesTabularExit(plugin.OutputPreparationPlugin):
batchesThroughput
=
record
[
'results'
][
'throughput'
][
0
]
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
].
append
([
'Number of batches produced'
,
'Batches'
,
batchesThroughput
])
unitsThroughput
=
record
[
'results'
][
'unitsThroughput'
][
0
]
unitsThroughput
=
record
[
'results'
].
get
(
'unitsThroughput'
,
None
)
if
unitsThroughput
:
unitsThroughput
=
unitsThroughput
[
0
]
if
not
unitsThroughput
:
unitsThroughput
=
batchesThroughput
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
].
append
([
'Number of units produced'
,
'Units'
,
unitsThroughput
])
lineThroughput
=
batchesThroughput
/
float
(
maxSimTime
)
...
...
@@ -62,6 +66,9 @@ class BatchesTabularExit(plugin.OutputPreparationPlugin):
"%.2f"
%
batchesThroughputCI
[
'lb'
],
"%.2f"
%
batchesThroughputCI
[
'ub'
]]
)
unitsThroughputList
=
record
[
'results'
].
get
(
'unitsThroughput'
,
None
)
if
not
unitsThroughputList
:
unitsThroughputList
=
batchesThroughputList
unitsThroughputList
=
record
[
'results'
][
'unitsThroughput'
]
unitsThroughputCI
=
self
.
getConfidenceInterval
(
unitsThroughputList
,
confidenceLevel
)
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
].
append
([
'Number of units produced'
,
'Units'
,
...
...
dream/plugins/ReadSkilledOperators.py
View file @
5aec2254
...
...
@@ -34,12 +34,17 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin):
"ouputSchedule"
:
1
}
operatorPresent
=
True
# for every station that has one or more skilled operators set operation type to MT-Load-Processing
for
stationId
in
skills
:
node
[
stationId
][
"operationType"
]
=
"MT-Load-Processing"
# add EventGenerator for the allocation every 10 minutes
# if there is at least one operator
if
operatorPresent
:
node
[
'EV123454321'
]
=
{
#(random id)
nodes
=
data
[
'graph'
][
'node'
]
for
station_id
,
station
in
nodes
.
iteritems
():
# set the operation type of all machines to MT-Load-Processing
if
station
[
'_class'
]
in
[
'Dream.BatchScrapMachine'
,
'Dream.BatchScrapMachineBeforeReassembly'
,
'Dream.BatchScrapMachineAfterDecompose'
,
'Dream.M3'
]:
station
[
"operationType"
]
=
"MT-Load-Processing"
# add EventGenerator for the allocation every 10 minutes
node
[
'EV123454321'
]
=
{
#(random id)
"name"
:
"Allocator"
,
"argumentDict"
:
"{}"
,
"interval"
:
10
,
...
...
@@ -49,9 +54,6 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin):
"interruptions"
:
{},
"_class"
:
"Dream.EventGenerator"
,
"method"
:
"Dream.ManPyObject.requestAllocation"
}
# print '---------------------------------'
# print data['graph']['node']
# print '---------------------------------'
}
return
data
dream/simulation/Examples/GUI_instances/BatchAllInOneEmpty.json
View file @
5aec2254
...
...
@@ -224,16 +224,14 @@
"title"
:
"Buffer Levels"
,
"type"
:
"object_view"
},
"view_operator_gantt"
:
{
"configuration"
:
{
"data"
:
{
"Operator"
:
[]
}
},
"gadget"
:
"Output_viewGantt"
,
"title"
:
"Operator Gantt"
,
"type"
:
"object_view"
},
"view_operator_gantt"
:
{
"configuration"
:
{
"output_id"
:
"operator_gantt"
},
"gadget"
:
"Output_viewGantt"
,
"title"
:
"Operator Schedule"
,
"type"
:
"object_view"
},
"view_queue_stats"
:
{
"configuration"
:
{
"output_id"
:
"queue_statistics"
...
...
@@ -249,6 +247,14 @@
"gadget"
:
"Output_viewGraph"
,
"title"
:
"Station Utilization"
,
"type"
:
"object_view"
},
"view_operator_utilization"
:
{
"configuration"
:
{
"output_id"
:
"operator_utilization"
},
"gadget"
:
"Output_viewGraph"
,
"title"
:
"Operator Utilization"
,
"type"
:
"object_view"
}
},
"post_processing"
:
{
...
...
@@ -270,6 +276,14 @@
{
"_class"
:
"dream.plugins.BatchesTabularQueues.BatchesTabularQueues"
,
"output_id"
:
"buffer_output"
},
{
"_class"
:
"dream.plugins.BatchesOperatorUtilization.BatchesOperatorUtilization"
,
"output_id"
:
"operator_utilization"
},
{
"_class"
:
"dream.plugins.BatchesOperatorGantt.BatchesOperatorGantt"
,
"output_id"
:
"operator_gantt"
}
]
},
...
...
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