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
6c18bd7b
Commit
6c18bd7b
authored
Feb 24, 2015
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InsertQueues plugin tested and corrected
parent
7e37f6d0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
107 deletions
+107
-107
dream/plugins/InsertQueues.py
dream/plugins/InsertQueues.py
+107
-107
No files found.
dream/plugins/InsertQueues.py
View file @
6c18bd7b
...
...
@@ -9,6 +9,7 @@ from dream.plugins import plugin
# XXX HARDCODED
MACHINE_TYPE_SET
=
set
([
"Dream.MachineJobShop"
,
"Dream.MouldAssembly"
])
EXIT_TYPE_SET
=
set
([
"Dream.ExitJobShop"
])
class
InsertQueues
(
plugin
.
InputPreparationPlugin
):
""" Input preparation
reads the data from external data base and inserts buffers before the corresponding stations
...
...
@@ -27,7 +28,7 @@ class InsertQueues(plugin.InputPreparationPlugin):
continue
if
not
self
.
data
[
"graph"
][
"node"
][
predecessor_step
][
"_class"
]
in
MACHINE_TYPE_SET
:
predecessor_list
=
[
predecessor_step
]
+
predecessor_list
predecessor_list
=
[
x
for
x
in
getNotMachineNodePredecessorList
([
predecessor_step
])
\
predecessor_list
=
[
x
for
x
in
self
.
getNotMachineNodePredecessorList
([
predecessor_step
])
\
if
x
not
in
predecessor_list
]
+
predecessor_list
return
predecessor_list
...
...
@@ -45,10 +46,18 @@ class InsertQueues(plugin.InputPreparationPlugin):
continue
if
not
self
.
data
[
"graph"
][
"node"
][
successor_step
][
"_class"
]
in
MACHINE_TYPE_SET
:
successor_list
=
[
successor_step
]
+
successor_list
successor_list
=
[
x
for
x
in
getNotMachineNodeSuccessorList
([
successor_step
])
\
successor_list
=
[
x
for
x
in
self
.
getNotMachineNodeSuccessorList
([
successor_step
])
\
if
x
not
in
successor_list
]
+
successor_list
return
successor_list
def
getExitStations
(
self
):
"""returns the exits of the system"""
nodes
=
self
.
data
[
"graph"
][
"node"
]
exitList
=
[]
for
nodeID
,
node
in
nodes
.
iteritems
():
if
node
[
"_class"
]
in
EXIT_TYPE_SET
:
exitList
.
append
(
nodeID
)
return
exitList
def
preprocess
(
self
,
data
):
""" inserts buffers before the corresponding stations
...
...
@@ -56,95 +65,86 @@ class InsertQueues(plugin.InputPreparationPlugin):
self
.
data
=
copy
(
data
)
orders
=
self
.
data
[
"input"
][
"BOM"
][
"orders"
]
nodes
=
self
.
data
[
"graph"
][
"node"
]
for
order
in
orders
:
orderComponents
=
order
.
get
(
"componentsList"
,
[])
for
component
in
orderComponents
:
updatedRoute
=
[]
route
=
component
.
get
(
"route"
,
[])
componentType
=
None
index
=
0
tempRoute
=
copy
.
deep
copy
(
route
)
tempRoute
=
copy
(
route
)
for
tempIndex
,
step
in
enumerate
(
tempRoute
):
stationIdsList
=
step
.
get
(
"stationIdsList"
,
[])
technology
=
step
[
"technology"
]
sequence
=
step
[
"sequence"
]
task_id
=
step
[
"task_id"
]
''' add predecessors wherever needed (buffers, OrderDecomposition) '''
predecessor_list
=
[]
for
predecessor
in
self
.
getNotMachineNodePredecessorList
(
stationIdsList
):
# # if the component is a mould then before the assembly do not add AssemblyBuffer
if
predecessor
.
startswith
(
"ASSM"
):
break
# # if there is a QCAM there must an OrderDecomposition inserted before that
if
predecessor
.
startswith
(
"QCAM"
):
pre_predecessor_list
=
[]
for
pre_predecessor
in
self
.
getNotMachineNodePredecessorList
([
predecessor
]):
pre_predecessor_list
.
append
(
pre_predecessor
)
if
pre_predecessor_list
:
route
.
insert
(
index
,
{
"stationIdsList"
:
pre_predecessor_list
,
"sequence"
:
""
,
"task_id"
:
""
,})
index
+=
1
predecessor_list
.
append
(
predecessor
)
if
predecessor_list
:
route
.
insert
(
index
,
{
"stationIdsList"
:
predecessor_list
,
"sequence"
:
sequence
,
"task_id"
:
task_id
})
# if the predecessor is OrderDecomposition then task_id and sequence are ""
if
predecessor
.
startswith
(
"OD"
):
temp_sequence
=
temp_task_id
=
""
else
:
temp_sequence
=
sequence
temp_task_id
=
task_id
route
.
insert
(
index
,
{
"stationIdsList"
:
[
predecessor
],
"sequence"
:
temp_sequence
,
"task_id"
:
temp_task_id
})
index
+=
1
'''find out if the part's route starts with ASSM'''
if
technology
.
startswith
(
"ASS"
)
and
tempIndex
==
0
:
componentType
=
"Mold"
''' add successors wherever needed (buffers, OrderDecomposition, exit, AssemblyBuffer, Assembly stations) '''
# # design case - add OrderDecomposition at the end of a design route
if
any
(
station
.
startswith
(
"CAD"
)
for
station
in
stationIdsList
)
and
tempIndex
==
len
(
tempRoute
)
-
1
:
successor_list
=
[]
for
successor
in
self
.
getNotMachineNodeSuccessorList
(
stationIdsList
):
successor_list
.
append
(
successor
)
if
successor_list
:
route
.
insert
(
index
,
{
"stationIdsList"
:
successor_list
,
# if the successor is a CAM buffer then do not add it to the route of the design
if
successor
.
startswith
(
"QCAM"
):
continue
route
.
append
({
"stationIdsList"
:
[
successor
],
"sequence"
:
""
,
"task_id"
:
""
})
index
+=
1
# # mould case - add exit at the a mould route
elif
any
(
station
.
startswith
(
"INJM"
)
for
station
in
stationIdsList
)
and
tempIndex
==
len
(
tempRoute
)
-
1
:
successor_list
=
[]
for
successor
in
self
.
getNotMachineNodeSuccessorList
(
stationIdsList
):
successor_list
.
append
(
successor
)
if
successor_list
:
route
.
insert
(
index
,
{
"stationIdsList"
:
successor_list
,
elif
componentType
==
"Mold"
and
tempIndex
==
len
(
tempRoute
)
-
1
:
route
.
append
({
"stationIdsList"
:
self
.
getExitStations
(),
"sequence"
:
sequence
,
"task_id"
:
task_id
})
index
+=
1
# # normal components - add ASSM buffer and ASSM at the end of their route
elif
tempIndex
==
len
(
tempRoute
)
-
1
:
exitAssigned
=
any
(
station
.
startswith
(
"ASS"
)
for
station
in
stationIdsList
)
elif
tempIndex
==
len
(
tempRoute
)
-
1
and
not
componentType
==
"Mold"
:
# exitAssigned=any(station.startswith("ASS") for station in stationIdsList)
exitAssigned
=
technology
.
startswith
(
"ASS"
)
if
not
exitAssigned
:
"""find the sequence and tas
_id that has the assembly for the mould component"""
"""find the sequence and task
_id that has the assembly for the mould component"""
for
sibling
in
orderComponents
:
for
siblingStep
in
sibling
[
"route"
]:
if
any
(
proc
.
startswith
(
"ASS"
)
for
proc
in
siblingStep
[
"stationIdsList"
]):
# if any(proc.startswith("ASS") for proc in siblingStep["stationIdsList"]):
if
siblingStep
.
get
(
"technology"
,
" "
).
startswith
(
"ASS"
):
if
siblingStep
[
"task_id"
]:
assembly_sequence
=
siblingStep
[
"sequence"
]
assembly_task_id
=
siblingStep
[
"task_id"
]
# # add assemble buffers to the route
assemblyBufferIDlist
=
[]
for
nodeID
,
node
in
nodes
.
items
():
if
node
[
"_class"
]
=
"Dream.MouldAssemblyBuffer"
:
if
node
[
"_class"
]
=
=
"Dream.MouldAssemblyBuffer"
:
assemblyBufferIDlist
.
append
(
str
(
nodeID
))
if
assemblyBufferIDlist
:
route
.
insert
(
index
,
{
"stationIdsList"
:
assemblyBufferIDlist
,
route
.
append
(
{
"stationIdsList"
:
assemblyBufferIDlist
,
"sequence"
:
assembly_sequence
,
"task_id"
:
assembly_task_id
})
index
+=
1
# # add assemblers to the route
assemblyIDlist
=
[]
for
nodeID
,
node
in
nodes
.
items
():
if
node
[
"_class"
]
=
"Dream.MouldAssembly"
:
if
node
[
"_class"
]
=
=
"Dream.MouldAssembly"
:
assemblyIDlist
.
append
(
str
(
nodeID
))
if
assemblyIDlist
:
route
.
insert
(
index
,
{
"stationIdsList"
:
assemblyIDlist
,
route
.
append
(
{
"stationIdsList"
:
assemblyIDlist
,
"sequence"
:
assembly_sequence
,
"task_id"
:
assembly_task_id
})
index
+=
1
index
+=
1
return
data
if
__name__
==
'__main__'
:
...
...
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