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
41f8415a
Commit
41f8415a
authored
Jan 21, 2014
by
Ioannis Papagiannopoulos
Committed by
Jérome Perrin
Feb 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OrderDecomposition modified to avoid creating entities of type Mould
parent
ec0a8e72
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
73 deletions
+99
-73
dream/simulation/Order.py
dream/simulation/Order.py
+12
-2
dream/simulation/OrderComponent.py
dream/simulation/OrderComponent.py
+11
-3
dream/simulation/OrderDecomposition.py
dream/simulation/OrderDecomposition.py
+76
-68
No files found.
dream/simulation/Order.py
View file @
41f8415a
...
...
@@ -34,8 +34,18 @@ from Job import Job
class
Order
(
Job
):
type
=
"Order"
def
__init__
(
self
,
id
=
None
,
name
=
None
,
route
=
[],
priority
=
0
,
dueDate
=
None
,
orderDate
=
None
,
isCritical
=
False
,
componentsList
=
[],
manager
=
None
,
basicsEnded
=
0
,
componentsReadyForAssembly
=
0
,
extraPropertyDict
=
None
):
def
__init__
(
self
,
id
=
None
,
name
=
None
,
route
=
[],
priority
=
0
,
dueDate
=
None
,
orderDate
=
None
,
isCritical
=
False
,
componentsList
=
[],
manager
=
None
,
basicsEnded
=
0
,
componentsReadyForAssembly
=
0
,
extraPropertyDict
=
None
):
Job
.
__init__
(
self
,
id
=
id
,
name
=
name
,
route
=
route
,
priority
=
priority
,
dueDate
=
dueDate
,
orderDate
=
orderDate
,
extraPropertyDict
=
extraPropertyDict
)
self
.
isCritical
=
isCritical
# flag to inform weather the order is critical -> preemption
...
...
dream/simulation/OrderComponent.py
View file @
41f8415a
...
...
@@ -34,9 +34,17 @@ from Job import Job
class
OrderComponent
(
Job
):
# inherits from the Job class
type
=
"OrderComponent"
def
__init__
(
self
,
id
=
None
,
name
=
None
,
route
=
[],
priority
=
0
,
dueDate
=
None
,
orderDate
=
None
,
extraPropertyDict
=
None
,
componentType
=
'Basic'
,
order
=
None
,
requestingComponent
=
None
,
readyForAssembly
=
0
,
isCritical
=
False
):
def
__init__
(
self
,
id
=
None
,
name
=
None
,
route
=
[],
priority
=
0
,
dueDate
=
None
,
orderDate
=
None
,
extraPropertyDict
=
None
,
componentType
=
'Basic'
,
order
=
None
,
requestingComponent
=
None
,
readyForAssembly
=
0
,
isCritical
=
False
):
Job
.
__init__
(
self
,
id
,
name
,
route
,
priority
,
dueDate
,
orderDate
,
extraPropertyDict
)
self
.
auxiliaryList
=
[]
# Holds the auxiliary components that the component needs for a certain processing
self
.
order
=
order
# parent order of the order component
...
...
dream/simulation/OrderDecomposition.py
View file @
41f8415a
...
...
@@ -192,73 +192,81 @@ class OrderDecomposition(CoreObject):
# creates the components
# =======================================================================
def
createOrderComponent
(
self
,
component
):
#read attributes fromthe json or from the orderToBeDecomposed
#read attributes from
the json or from the orderToBeDecomposed
id
=
component
.
get
(
'id'
,
'not found'
)
name
=
component
.
get
(
'name'
,
'not found'
)
# variable that holds the componentType which can be Basic/Secondary/Auxiliary
componentType
=
component
.
get
(
'componentType'
,
'Basic'
)
# the component that needs the auxiliary (if the componentType is "Auxiliary") during its processing
requestingComponent
=
component
.
get
(
'requestingComponent'
,
'not found'
)
# dummy variable that holds the routes of the jobs the route from the JSON file is a sequence of dictionaries
JSONRoute
=
component
.
get
(
'route'
,
[])
# variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list
route
=
[
None
for
i
in
range
(
len
(
JSONRoute
))]
for
routeentity
in
JSONRoute
:
# for each 'step' dictionary in the JSONRoute
stepNumber
=
int
(
routeentity
.
get
(
'stepNumber'
,
'0'
))
# get the stepNumber
# routeentity.pop(str(stepNumber),None) # remove the stepNumber key
route
[
stepNumber
]
=
routeentity
# keep a reference of all extra properties passed to the job
extraPropertyDict
=
{}
for
key
,
value
in
component
.
items
():
if
key
not
in
(
'_class'
,
'id'
):
extraPropertyDict
[
key
]
=
value
#Below it is to assign an exit if it was not assigned in JSON
#have to talk about it with NEX
exitAssigned
=
False
for
element
in
route
:
# elementId=element[0]
elementIds
=
element
.
get
(
'stationIdsList'
,[])
for
obj
in
G
.
ObjList
:
for
elementId
in
elementIds
:
if
obj
.
id
==
elementId
and
obj
.
type
==
'Exit'
:
exitAssigned
=
True
if
not
exitAssigned
:
exitId
=
None
for
obj
in
G
.
ObjList
:
if
obj
.
type
==
'Exit'
:
exitId
=
obj
.
id
break
if
exitId
:
# route.append([exitId, 0])
route
.
append
({
'stationIdsList'
:[
str
(
exitId
)],
\
'processingTime'
:{}})
# initiate the OrderComponent
OC
=
OrderComponent
(
id
,
name
,
route
,
\
priority
=
self
.
orderToBeDecomposed
.
priority
,
\
dueDate
=
self
.
orderToBeDecomposed
.
dueDate
,
\
componentType
=
componentType
,
\
requestingComponent
=
requestingComponent
,
\
order
=
self
.
orderToBeDecomposed
,
\
orderDate
=
self
.
orderToBeDecomposed
.
orderDate
,
\
extraPropertyDict
=
extraPropertyDict
,
\
isCritical
=
self
.
orderToBeDecomposed
.
isCritical
)
# check the componentType of the component and accordingly add to the corresponding list of the parent order
if
OC
.
componentType
==
'Basic'
:
self
.
orderToBeDecomposed
.
basicComponentsList
.
append
(
OC
)
elif
OC
.
componentType
==
'Secondary'
:
self
.
orderToBeDecomposed
.
secondaryComponentsList
.
append
(
OC
)
else
:
self
.
orderToBeDecomposed
.
auxiliaryComponentsList
.
append
(
OC
)
G
.
OrderComponentList
.
append
(
OC
)
G
.
JobList
.
append
(
OC
)
G
.
WipList
.
append
(
OC
)
G
.
EntityList
.
append
(
OC
)
self
.
newlyCreatedComponents
.
append
(
OC
)
#keep these to pass them to setWIP
OC
.
initialize
()
#initialize the component
\ No newline at end of file
# there is the case were the component of the componentsList of the parent Order
# is of type Mould and therefore has no argument componentType
# in this case no Mould object should be initiated
try
:
# variable that holds the componentType which can be Basic/Secondary/Auxiliary
componentType
=
component
.
get
(
'componentType'
,
'Basic'
)
# the component that needs the auxiliary (if the componentType is "Auxiliary") during its processing
requestingComponent
=
component
.
get
(
'requestingComponent'
,
'not found'
)
# dummy variable that holds the routes of the jobs the route from the JSON file is a sequence of dictionaries
JSONRoute
=
component
.
get
(
'route'
,
[])
# variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list
route
=
[
None
for
i
in
range
(
len
(
JSONRoute
))]
for
routeentity
in
JSONRoute
:
# for each 'step' dictionary in the JSONRoute
stepNumber
=
int
(
routeentity
.
get
(
'stepNumber'
,
'0'
))
# get the stepNumber
# routeentity.pop(str(stepNumber),None) # remove the stepNumber key
route
[
stepNumber
]
=
routeentity
# keep a reference of all extra properties passed to the job
extraPropertyDict
=
{}
for
key
,
value
in
component
.
items
():
if
key
not
in
(
'_class'
,
'id'
):
extraPropertyDict
[
key
]
=
value
#Below it is to assign an exit if it was not assigned in JSON
#have to talk about it with NEX
exitAssigned
=
False
for
element
in
route
:
# elementId=element[0]
elementIds
=
element
.
get
(
'stationIdsList'
,[])
for
obj
in
G
.
ObjList
:
for
elementId
in
elementIds
:
if
obj
.
id
==
elementId
and
obj
.
type
==
'Exit'
:
exitAssigned
=
True
if
not
exitAssigned
:
exitId
=
None
for
obj
in
G
.
ObjList
:
if
obj
.
type
==
'Exit'
:
exitId
=
obj
.
id
break
if
exitId
:
# route.append([exitId, 0])
route
.
append
({
'stationIdsList'
:[
str
(
exitId
)],
\
'processingTime'
:{}})
# initiate the OrderComponent
OC
=
OrderComponent
(
id
,
name
,
route
,
\
priority
=
self
.
orderToBeDecomposed
.
priority
,
\
dueDate
=
self
.
orderToBeDecomposed
.
dueDate
,
\
componentType
=
componentType
,
\
requestingComponent
=
requestingComponent
,
\
order
=
self
.
orderToBeDecomposed
,
\
orderDate
=
self
.
orderToBeDecomposed
.
orderDate
,
\
extraPropertyDict
=
extraPropertyDict
,
\
isCritical
=
self
.
orderToBeDecomposed
.
isCritical
)
# check the componentType of the component and accordingly add to the corresponding list of the parent order
if
OC
.
componentType
==
'Basic'
:
self
.
orderToBeDecomposed
.
basicComponentsList
.
append
(
OC
)
elif
OC
.
componentType
==
'Secondary'
:
self
.
orderToBeDecomposed
.
secondaryComponentsList
.
append
(
OC
)
else
:
self
.
orderToBeDecomposed
.
auxiliaryComponentsList
.
append
(
OC
)
G
.
OrderComponentList
.
append
(
OC
)
G
.
JobList
.
append
(
OC
)
G
.
WipList
.
append
(
OC
)
G
.
EntityList
.
append
(
OC
)
self
.
newlyCreatedComponents
.
append
(
OC
)
#keep these to pass them to setWIP
OC
.
initialize
()
#initialize the component
except
:
# added for testing
print
'the component of the order'
,
sefl
.
orderToBeDecomposed
.
name
,
'is of type Mould
\
and thus nothing is created'
,
'time'
,
now
()
\ 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