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
14a4753f
Commit
14a4753f
authored
Apr 24, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DemandProfile added as initial work to transform excel to JSON
parent
006ea15d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
158 additions
and
0 deletions
+158
-0
dream/simulation/GUI/DemandPlanning.py
dream/simulation/GUI/DemandPlanning.py
+158
-0
dream/simulation/GUI/DemandProfile.xlsx
dream/simulation/GUI/DemandProfile.xlsx
+0
-0
dream/simulation/GUI/inputs.xlsx
dream/simulation/GUI/inputs.xlsx
+0
-0
No files found.
dream/simulation/GUI/DemandPlanning.py
0 → 100644
View file @
14a4753f
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 17 Apr 2014
@author: George
'''
'''
test script to convert the static excels to JSON. It does not communicate with GUI yet
'''
import
xlwt
import
xlrd
import
json
'''
Created on 5 Sep 2013
@author: Anna
'''
class
G
:
TargetPPOS
=
0
TargetPPOSqty
=
0
TargetPPOSweek
=
0
ReplicationNo
=
0
replication
=
0
PPOSlist
=
{}
Capacity
=
[]
route
=
{}
maxEarliness
=
0
# max number of weeks for earliness
maxLateness
=
0
# max number of weeks for lateness
planningHorizon
=
0
# for future demand purposes
demandFile
=
None
currentCapacity
=
None
reCapacity
=
[]
PPOSprofile
=
[]
# initial disaggregation for PPOS
FutureProfile
=
[]
# initial disaggregation for future demand
AllocationFuture
=
[]
FutureLateness
=
[]
FutureEarliness
=
[]
AllocationPPOS
=
[]
PPOSLateness
=
[]
PPOSEarliness
=
[]
minPackingSize
=
0
Buffer
=
[]
ExcessPPOSBuffer
=
[]
ExcessPPOSminBuffer
=
[]
ExcessFutureBuffer
=
[]
ExcessFutureMinBuffer
=
[]
DistributionType
=
None
CapacityDict
=
{}
RouteDict
=
{}
# filterItem = 0
# filterWeek = 0
#===================================
# import simulation input data
#===================================
def
readGeneralInput
():
# general simulation input
wbin
=
xlrd
.
open_workbook
(
'GUI/inputs.xlsx'
)
sh
=
wbin
.
sheet_by_name
(
'Scalar_Var'
)
G
.
TargetPPOS
=
int
(
sh
.
cell
(
2
,
1
).
value
)
-
1
G
.
TargetPPOSqty
=
int
(
sh
.
cell
(
3
,
1
).
value
)
G
.
TargetPPOSweek
=
int
(
sh
.
cell
(
6
,
1
).
value
)
-
1
G
.
planningHorizon
=
int
(
sh
.
cell
(
7
,
1
).
value
)
G
.
ReplicationNo
=
int
(
sh
.
cell
(
15
,
1
).
value
)
G
.
maxEarliness
=
int
(
sh
.
cell
(
18
,
1
).
value
)
G
.
maxLateness
=
int
(
sh
.
cell
(
19
,
1
).
value
)
G
.
minPackingSize
=
int
(
sh
.
cell
(
22
,
1
).
value
)
# capacity information
sh
=
wbin
.
sheet_by_name
(
'Capacity'
)
nCols
=
sh
.
ncols
nRows
=
sh
.
nrows
assert
(
nCols
==
G
.
planningHorizon
+
1
)
capacity
=
[]
# for i in range(1,nCols):
# capacity.append(sh.col_values(i,2))
for
i
in
range
(
2
,
nRows
):
capacity
.
append
(
sh
.
row_values
(
i
,
1
,
4
))
G
.
Capacity
=
capacity
# PPOS-MA disaggregation and corresponding routes
sh
=
wbin
.
sheet_by_name
(
'Route'
)
nRows
=
sh
.
nrows
nCols
=
sh
.
ncols
# prepare a dict that holds the capacity of every bottleneck per week
for
i
in
range
(
3
,
nCols
):
G
.
CapacityDict
[
sh
.
cell
(
2
,
i
).
value
]
=
G
.
Capacity
[
i
-
3
]
for
i
in
range
(
4
,
nRows
):
tempPPOSlist
=
sh
.
row_values
(
i
,
0
,
3
)
id
=
tempPPOSlist
[
2
]
ppos
=
tempPPOSlist
[
0
]
sp
=
tempPPOSlist
[
1
]
routeValues
=
sh
.
row_values
(
i
,
3
,
nCols
)
G
.
RouteDict
[
id
]
=
{
'PPOS'
:
ppos
,
'SP'
:
sp
,
'route'
:{}}
for
j
in
range
(
len
(
routeValues
)):
G
.
RouteDict
[
id
][
'route'
][
sh
.
cell
(
2
,
j
+
3
).
value
]
=
routeValues
[
j
]
def
main
():
# read from inputs spreadsheet
readGeneralInput
()
# open json file
argumentDictFile
=
open
(
'argumentDict.json'
,
mode
=
'w'
)
argumentDict
=
{}
argumentDict
[
'argumentDict'
]
=
{}
# set general attributes
argumentDict
[
'general'
]
=
{}
argumentDict
[
'general'
][
'maxSimTime'
]
=
G
.
planningHorizon
argumentDict
[
'general'
][
'numberOfReplications'
]
=
G
.
ReplicationNo
# set current PPOS attributes
argumentDict
[
'argumentDict'
][
'currentPPOS'
]
=
{}
argumentDict
[
'argumentDict'
][
'currentPPOS'
][
'id'
]
=
G
.
TargetPPOS
argumentDict
[
'argumentDict'
][
'currentPPOS'
][
'quantity'
]
=
G
.
TargetPPOSqty
argumentDict
[
'argumentDict'
][
'currentPPOS'
][
'targetWeek'
]
=
G
.
TargetPPOSweek
# set allocation attributes
argumentDict
[
'argumentDict'
][
'allocationData'
]
=
{}
argumentDict
[
'argumentDict'
][
'allocationData'
][
'maxEarliness'
]
=
G
.
maxEarliness
argumentDict
[
'argumentDict'
][
'allocationData'
][
'maxLateness'
]
=
G
.
maxLateness
argumentDict
[
'argumentDict'
][
'allocationData'
][
'minPackingSize'
]
=
G
.
minPackingSize
# set capacity attributes
argumentDict
[
'argumentDict'
][
'capacity'
]
=
G
.
CapacityDict
# set MA attributes
argumentDict
[
'argumentDict'
][
'MA'
]
=
G
.
RouteDict
argumentDictString
=
json
.
dumps
(
argumentDict
,
indent
=
5
)
argumentDictFile
.
write
(
argumentDictString
)
if
__name__
==
'__main__'
:
main
()
dream/simulation/GUI/DemandProfile.xlsx
0 → 100644
View file @
14a4753f
File added
dream/simulation/GUI/inputs.xlsx
0 → 100644
View file @
14a4753f
File added
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