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
b73cc328
Commit
b73cc328
authored
Mar 13, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sample script to take DB extracted data and put it in CapacityStation configuration. WIP is missing
parent
97d48c06
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1755 additions
and
0 deletions
+1755
-0
dream/KnowledgeExtraction/PilotCases/CapacityStations/OutputPreparation.py
...traction/PilotCases/CapacityStations/OutputPreparation.py
+87
-0
dream/KnowledgeExtraction/PilotCases/CapacityStations/__init__.py
...owledgeExtraction/PilotCases/CapacityStations/__init__.py
+24
-0
dream/KnowledgeExtraction/PilotCases/CapacityStations/sampleConfiguration.json
...tion/PilotCases/CapacityStations/sampleConfiguration.json
+1453
-0
dream/KnowledgeExtraction/PilotCases/CapacityStations/sampleDBExtraction.json
...ction/PilotCases/CapacityStations/sampleDBExtraction.json
+191
-0
No files found.
dream/KnowledgeExtraction/PilotCases/CapacityStations/OutputPreparation.py
0 → 100644
View file @
b73cc328
# ===========================================================================
# 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/>.
# ===========================================================================
import
json
from
datetime
import
datetime
configuration
=
open
(
"PilotCases
\
C
a
pacityStations
\
s
a
mpleConfiguration.json"
,
"r"
)
# configuration=open("sampleConfiguration.json", "r")
configurationData
=
configuration
.
read
()
configurationJSON
=
json
.
loads
(
configurationData
)
db
=
open
(
"PilotCases
\
C
a
pacityStations
\
s
a
mpleDBExtraction.json"
,
"r"
)
# configuration=open("sampleConfiguration.json", "r")
dbData
=
db
.
read
()
dbJSON
=
json
.
loads
(
dbData
)
operations
=
dbJSON
.
get
(
'operations'
,{})
stations
=
configurationJSON
[
'graph'
][
'node'
]
currentDate
=
configurationJSON
[
'general'
][
'currentDate'
]
currentDate
=
datetime
.
strptime
(
currentDate
,
'%Y/%m/%d'
)
# set the interval capacity of the stations
for
operationId
,
operation
in
operations
.
iteritems
():
intervalCapacity
=
operation
.
get
(
'intervalCapacity'
,[])
for
stationId
,
station
in
stations
.
iteritems
():
if
stationId
==
operationId
:
station
[
'intervalCapacity'
]
=
intervalCapacity
orders
=
dbJSON
.
get
(
'orders'
,{})
configurationJSON
[
'input'
][
'BOM'
][
'productionOrders'
]
=
[]
capacityRequirementDict
=
{}
earliestStartDict
=
{}
for
order
in
orders
:
for
operation
in
order
[
'sequence'
]:
operationId
=
operation
.
keys
()[
0
]
capacityRequirementDict
[
operationId
]
=
operation
[
operationId
][
'requiredCapacity'
]
earliestStart
=
operation
[
operationId
].
get
(
'earliestStart'
,
None
)
if
earliestStart
:
earliestStart
=
datetime
.
strptime
(
earliestStart
,
'%Y-%m-%d'
)
earliestStartDict
[
operationId
]
=
(
earliestStart
-
currentDate
).
days
assemblySpaceRequirement
=
order
.
get
(
'floorSpaceRequired'
,
100
)
orderId
=
order
[
'orderID'
]
dueDate
=
order
.
get
(
'dueDate'
,
100
)
dueDate
=
datetime
.
strptime
(
dueDate
,
'%Y-%m-%d'
)
dueDate
=
(
dueDate
-
currentDate
).
days
orderDate
=
order
.
get
(
'orderDate'
,
0
)
orderDate
=
datetime
.
strptime
(
orderDate
,
'%Y-%m-%d'
)
orderDate
=
(
orderDate
-
currentDate
).
days
name
=
order
.
get
(
'orderName'
,
orderId
)
configurationJSON
[
'input'
][
'BOM'
][
'productionOrders'
].
append
({
"capacityRequirementDict"
:
capacityRequirementDict
,
"assemblySpaceRequirement"
:
assemblySpaceRequirement
,
"name"
:
name
,
"id"
:
orderId
,
"earliestStartDict"
:
earliestStartDict
,
"_class"
:
"dream.simulation.applications.CapacityStations.CapacityProject.CapacityProject"
,
"dueDate"
:
dueDate
,
"orderDate"
:
orderDate
})
updatedModelJSONString
=
json
.
dumps
(
configurationJSON
,
indent
=
5
)
updatedModel
=
open
(
'UpdatedModel.json'
,
mode
=
'w'
)
updatedModel
.
write
(
updatedModelJSONString
)
dream/KnowledgeExtraction/PilotCases/CapacityStations/__init__.py
0 → 100644
View file @
b73cc328
# ===========================================================================
# 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/>.
# ===========================================================================
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
).
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
\ No newline at end of file
dream/KnowledgeExtraction/PilotCases/CapacityStations/sampleConfiguration.json
0 → 100644
View file @
b73cc328
This diff is collapsed.
Click to expand it.
dream/KnowledgeExtraction/PilotCases/CapacityStations/sampleDBExtraction.json
0 → 100644
View file @
b73cc328
{
"operations"
:
{
"WELD"
:
{
"name"
:
"WELD"
,
"intervalCapacity"
:
[
250
,
350
,
450
,
550
,
650
,
0
,
0
]
},
"MCH"
:
{
"name"
:
"MCH"
,
"intervalCapacity"
:
[
310
,
410
,
510
,
610
,
710
,
0
,
0
]
},
"EEP"
:
{
"name"
:
"EEP"
,
"intervalCapacity"
:
[
345
,
445
,
545
,
645
,
745
,
0
,
0
]
},
"ASBTST"
:
{
"name"
:
"ASBTST"
,
"intervalCapacity"
:
[
420
,
350
,
380
,
480
,
560
,
0
,
0
]
},
"PAINT"
:
{
"name"
:
"PAINT"
,
"intervalCapacity"
:
[
415
,
515
,
615
,
715
,
815
,
0
,
0
]
},
"CNC"
:
{
"name"
:
"CNC"
,
"intervalCapacity"
:
[
270
,
370
,
470
,
570
,
670
,
0
,
0
]
},
"PPASB"
:
{
"name"
:
"PPASB"
,
"intervalCapacity"
:
[
380
,
300
,
580
,
680
,
780
,
0
,
0
]
},
"SMF"
:
{
"name"
:
"SMF"
,
"intervalCapacity"
:
[
180
,
300
,
400
,
500
,
600
,
0
,
0
]
}
},
"orders"
:
[
{
"orderID"
:
"Tade"
,
"customer"
:
"t1"
,
"floorSpaceRequired"
:
400
,
"sequence"
:
[
{
"SMF"
:
{
"operation"
:
"SMF"
,
"earliestStart"
:
"2014-08-25"
,
"task_id"
:
"ID-001"
,
"requiredCapacity"
:
30
}
},
{
"WELD"
:
{
"operation"
:
"WELD"
,
"earliestStart"
:
"2014-08-26"
,
"task_id"
:
"ID-002"
,
"requiredCapacity"
:
15
}
},
{
"CNC"
:
{
"operation"
:
"CNC"
,
"earliestStart"
:
"2014-08-27"
,
"task_id"
:
"ID-003"
,
"requiredCapacity"
:
45
}
},
{
"MCH"
:
{
"operation"
:
"MCH"
,
"earliestStart"
:
"2014-08-28"
,
"task_id"
:
"ID-004"
,
"requiredCapacity"
:
25
}
},
{
"EEP"
:
{
"operation"
:
"EEP"
,
"earliestStart"
:
"2014-08-29"
,
"task_id"
:
"ID-005"
,
"requiredCapacity"
:
15
}
},
{
"PPASB"
:
{
"operation"
:
"PPASB"
,
"earliestStart"
:
"2014-08-30"
,
"task_id"
:
"ID-006"
,
"requiredCapacity"
:
25
}
},
{
"PAINT"
:
{
"operation"
:
"PAINT"
,
"earliestStart"
:
"2014-08-31"
,
"task_id"
:
"ID-007"
,
"requiredCapacity"
:
35
}
},
{
"ASBTST"
:
{
"operation"
:
"ASBTST"
,
"earliestStart"
:
"2014-09-01"
,
"task_id"
:
"ID-008"
,
"requiredCapacity"
:
45
}
}
],
"dueDate"
:
"2014-08-25"
,
"orderName"
:
"italy"
,
"orderDate"
:
"2014-08-19"
}
],
"WIP"
:
{
"WELD_idTade"
:
{
"order_id"
:
"Tade"
,
"buffered"
:
10.0
,
"operation"
:
"WELD"
},
"ID-001"
:
{
"End date"
:
"None"
,
"Total Capacity required"
:
30
,
"Capacity required"
:
10
,
"order_id"
:
"Tade"
,
"operation"
:
"SMF"
,
"Start date"
:
"2015-03-13"
}
}
}
\ No newline at end of file
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