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
d9083295
Commit
d9083295
authored
Feb 26, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'demandPlanningLine'
parents
abdb3aa1
c91b9f67
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
2 deletions
+85
-2
dream/plugins/DemandPlanningLine.py
dream/plugins/DemandPlanningLine.py
+56
-0
dream/plugins/PostProcessDemandPlanning.py
dream/plugins/PostProcessDemandPlanning.py
+4
-0
dream/simulation/Examples/GUI_instances/DemandPlanningAllInOneEmpty.json
...n/Examples/GUI_instances/DemandPlanningAllInOneEmpty.json
+13
-1
dream/simulation/applications/DemandPlanning/Globals.py
dream/simulation/applications/DemandPlanning/Globals.py
+1
-0
dream/simulation/applications/DemandPlanning/outputResults.py
...m/simulation/applications/DemandPlanning/outputResults.py
+11
-1
No files found.
dream/plugins/DemandPlanningLine.py
0 → 100644
View file @
d9083295
from
dream.plugins
import
plugin
from
dream.plugins.TimeSupport
import
TimeSupportMixin
from
datetime
import
datetime
class
DemandPlanningLine
(
plugin
.
OutputPreparationPlugin
,
TimeSupportMixin
):
""" Output the queue statistics in a format compatible with Output_viewGraph
"""
def
postprocess
(
self
,
data
):
from
dream.simulation.applications.DemandPlanning.Globals
import
G
utilisation
=
G
.
Utilisation
# XXX current implementation for one bottleneck
bottleNeckUtilization
=
G
.
Utilisation
[
'BE_T_BE1S_TEST_EQ_FLEX_T417_3'
]
dateList
=
[]
# get the current date from the data
for
record_id
,
record
in
bottleNeckUtilization
.
iteritems
():
year
=
str
(
record_id
)[
0
:
4
]
week
=
str
(
record_id
)[
4
:]
fullDate
=
datetime
.
strptime
(
year
+
'-'
+
week
+
'-0'
,
'%Y-%W-%w'
)
dateList
.
append
(
fullDate
)
currentDate
=
str
(
min
(
dateList
))
currentDate
=
currentDate
.
replace
(
'-'
,
'/'
)
data
[
'general'
][
'currentDate'
]
=
currentDate
data
[
'general'
][
'timeUnit'
]
=
'week'
self
.
initializeTimeSupport
(
data
)
result
=
data
[
'result'
][
'result_list'
][
-
1
]
series
=
[]
options
=
{
"xaxis"
:
{
"mode"
:
"time"
,
"minTickSize"
:
[
1
,
self
.
getTimeUnitText
()],
}
}
result
[
self
.
configuration_dict
[
'output_id'
]]
=
{
"series"
:
series
,
"options"
:
options
}
# create the 3 lines
for
utilizationType
in
[
'averageUtilization'
,
'minUtilization'
,
'maxUtilization'
]:
utilizationList
=
[]
for
record_id
,
record
in
bottleNeckUtilization
.
iteritems
():
year
=
str
(
record_id
)[
0
:
4
]
week
=
str
(
record_id
)[
4
:]
fullDate
=
datetime
.
strptime
(
year
+
'-'
+
week
+
'-0'
,
'%Y-%W-%w'
)
utilizationList
.
append
([
fullDate
,
record
[
utilizationType
]])
utilizationList
.
sort
(
key
=
lambda
x
:
x
[
0
],
reverse
=
True
)
series
.
append
({
"label"
:
utilizationType
,
"data"
:
[((
time
-
datetime
(
1970
,
1
,
1
)).
total_seconds
()
*
1000
,
value
)
for
(
time
,
value
)
in
utilizationList
]
})
return
data
dream/plugins/PostProcessDemandPlanning.py
View file @
d9083295
...
...
@@ -14,4 +14,8 @@ class PostProcessDemandPlanning(plugin.OutputPreparationPlugin):
'mime_type'
:
'application/vnd.ms-excel'
,
'data'
:
G
.
reportResults
.
xlsx
.
encode
(
'base64'
)
}
import
json
utilisationString
=
json
.
dumps
(
G
.
Utilisation
,
indent
=
5
)
outputJSONFile
=
open
(
'Utilisation.json'
,
mode
=
'w'
)
outputJSONFile
.
write
(
utilisationString
)
return
data
dream/simulation/Examples/GUI_instances/DemandPlanningAllInOneEmpty.json
View file @
d9083295
...
...
@@ -141,6 +141,14 @@
"gadget"
:
"Output_viewDownloadFile"
,
"title"
:
"Download Result Spreadsheet"
,
"type"
:
"object_view"
},
"view_utilization_stats"
:
{
"configuration"
:
{
"output_id"
:
"bottleneck_utilization"
},
"gadget"
:
"Output_viewGraph"
,
"title"
:
"Bottleneck Utilization"
,
"type"
:
"object_view"
}
},
"post_processing"
:
{
...
...
@@ -148,6 +156,10 @@
{
"_class"
:
"dream.plugins.PostProcessDemandPlanning.PostProcessDemandPlanning"
,
"output_id"
:
"demand_planning_spreadsheet"
},
{
"_class"
:
"dream.plugins.DemandPlanningLine.DemandPlanningLine"
,
"output_id"
:
"bottleneck_utilization"
}
]
},
...
...
dream/simulation/applications/DemandPlanning/Globals.py
View file @
d9083295
...
...
@@ -47,6 +47,7 @@ class G:
Lateness
=
{}
Excess
=
{}
weightFactor
=
[
10.0
,
1.0
,
0
,
2
]
Utilisation
=
{}
# ACO parameters
ACO
=
1
...
...
dream/simulation/applications/DemandPlanning/outputResults.py
View file @
d9083295
...
...
@@ -41,6 +41,16 @@ def outputResults():
G
.
CapacityResults
.
append
([
''
,
'Capa Pegging Resource Total Load (UoM)'
,]
+
[
G
.
Capacity
[
bottleneck
][
week
][
'OriginalCapacity'
]
-
G
.
CurrentCapacityDict
[
bottleneck
][
week
]
for
week
in
G
.
WeekList
])
G
.
CapacityResults
.
append
([
''
,
'Capa Pegging Resource Total Util (Percent)'
,]
+
[
float
(
G
.
Capacity
[
bottleneck
][
week
][
'OriginalCapacity'
]
-
G
.
CurrentCapacityDict
[
bottleneck
][
week
])
/
G
.
Capacity
[
bottleneck
][
week
][
'OriginalCapacity'
]
*
100
for
week
in
G
.
WeekList
])
# utilisation results
for
bottleneck
in
G
.
Bottlenecks
:
G
.
Utilisation
[
bottleneck
]
=
{}
for
week
in
G
.
WeekList
:
G
.
Utilisation
[
bottleneck
][
week
]
=
{}
G
.
Utilisation
[
bottleneck
][
week
][
'averageUtilization'
]
=
float
(
G
.
Capacity
[
bottleneck
][
week
][
'OriginalCapacity'
]
-
G
.
CurrentCapacityDict
[
bottleneck
][
week
])
/
G
.
Capacity
[
bottleneck
][
week
][
'OriginalCapacity'
]
G
.
Utilisation
[
bottleneck
][
week
][
'minUtilization'
]
=
G
.
Capacity
[
bottleneck
][
week
][
'minUtilisation'
]
G
.
Utilisation
[
bottleneck
][
week
][
'maxUtilization'
]
=
G
.
Capacity
[
bottleneck
][
week
][
'targetUtilisation'
]
# report allocation results
head
=
[
'PPOS'
,
'Demand_Items_Product_DCBNO - SP'
,
'Demand_Items_Product_DCBNO - MA'
,
'Demand_Type - Group'
,
'Priority'
,
'Values'
]
+
G
.
WeekList
G
.
allocationResults
.
headers
=
head
...
...
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