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
...
@@ -34,8 +34,18 @@ from Job import Job
class
Order
(
Job
):
class
Order
(
Job
):
type
=
"Order"
type
=
"Order"
def
__init__
(
self
,
id
=
None
,
name
=
None
,
route
=
[],
priority
=
0
,
dueDate
=
None
,
orderDate
=
None
,
isCritical
=
False
,
def
__init__
(
self
,
id
=
None
,
componentsList
=
[],
manager
=
None
,
basicsEnded
=
0
,
componentsReadyForAssembly
=
0
,
extraPropertyDict
=
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
,
Job
.
__init__
(
self
,
id
=
id
,
name
=
name
,
route
=
route
,
priority
=
priority
,
dueDate
=
dueDate
,
orderDate
=
orderDate
,
extraPropertyDict
=
extraPropertyDict
)
extraPropertyDict
=
extraPropertyDict
)
self
.
isCritical
=
isCritical
# flag to inform weather the order is critical -> preemption
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
...
@@ -34,9 +34,17 @@ from Job import Job
class
OrderComponent
(
Job
):
# inherits from the Job class
class
OrderComponent
(
Job
):
# inherits from the Job class
type
=
"OrderComponent"
type
=
"OrderComponent"
def
__init__
(
self
,
id
=
None
,
name
=
None
,
route
=
[],
priority
=
0
,
dueDate
=
None
,
orderDate
=
None
,
extraPropertyDict
=
None
,
def
__init__
(
self
,
id
=
None
,
name
=
None
,
componentType
=
'Basic'
,
order
=
None
,
requestingComponent
=
None
,
route
=
[],
readyForAssembly
=
0
,
isCritical
=
False
):
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
)
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
.
auxiliaryList
=
[]
# Holds the auxiliary components that the component needs for a certain processing
self
.
order
=
order
# parent order of the order component
self
.
order
=
order
# parent order of the order component
...
...
dream/simulation/OrderDecomposition.py
View file @
41f8415a
...
@@ -192,73 +192,81 @@ class OrderDecomposition(CoreObject):
...
@@ -192,73 +192,81 @@ class OrderDecomposition(CoreObject):
# creates the components
# creates the components
# =======================================================================
# =======================================================================
def
createOrderComponent
(
self
,
component
):
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'
)
id
=
component
.
get
(
'id'
,
'not found'
)
name
=
component
.
get
(
'name'
,
'not found'
)
name
=
component
.
get
(
'name'
,
'not found'
)
# variable that holds the componentType which can be Basic/Secondary/Auxiliary
# there is the case were the component of the componentsList of the parent Order
componentType
=
component
.
get
(
'componentType'
,
'Basic'
)
# is of type Mould and therefore has no argument componentType
# the component that needs the auxiliary (if the componentType is "Auxiliary") during its processing
# in this case no Mould object should be initiated
requestingComponent
=
component
.
get
(
'requestingComponent'
,
'not found'
)
try
:
# dummy variable that holds the routes of the jobs the route from the JSON file is a sequence of dictionaries
# variable that holds the componentType which can be Basic/Secondary/Auxiliary
JSONRoute
=
component
.
get
(
'route'
,
[])
componentType
=
component
.
get
(
'componentType'
,
'Basic'
)
# variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list
# the component that needs the auxiliary (if the componentType is "Auxiliary") during its processing
route
=
[
None
for
i
in
range
(
len
(
JSONRoute
))]
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
for
routeentity
in
JSONRoute
:
# for each 'step' dictionary in the JSONRoute
JSONRoute
=
component
.
get
(
'route'
,
[])
stepNumber
=
int
(
routeentity
.
get
(
'stepNumber'
,
'0'
))
# get the stepNumber
# variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list
# routeentity.pop(str(stepNumber),None) # remove the stepNumber key
route
=
[
None
for
i
in
range
(
len
(
JSONRoute
))]
route
[
stepNumber
]
=
routeentity
for
routeentity
in
JSONRoute
:
# for each 'step' dictionary in the JSONRoute
# keep a reference of all extra properties passed to the job
stepNumber
=
int
(
routeentity
.
get
(
'stepNumber'
,
'0'
))
# get the stepNumber
extraPropertyDict
=
{}
# routeentity.pop(str(stepNumber),None) # remove the stepNumber key
for
key
,
value
in
component
.
items
():
route
[
stepNumber
]
=
routeentity
if
key
not
in
(
'_class'
,
'id'
):
extraPropertyDict
[
key
]
=
value
# keep a reference of all extra properties passed to the job
extraPropertyDict
=
{}
#Below it is to assign an exit if it was not assigned in JSON
for
key
,
value
in
component
.
items
():
#have to talk about it with NEX
if
key
not
in
(
'_class'
,
'id'
):
exitAssigned
=
False
extraPropertyDict
[
key
]
=
value
for
element
in
route
:
# elementId=element[0]
#Below it is to assign an exit if it was not assigned in JSON
elementIds
=
element
.
get
(
'stationIdsList'
,[])
#have to talk about it with NEX
for
obj
in
G
.
ObjList
:
exitAssigned
=
False
for
elementId
in
elementIds
:
for
element
in
route
:
if
obj
.
id
==
elementId
and
obj
.
type
==
'Exit'
:
# elementId=element[0]
exitAssigned
=
True
elementIds
=
element
.
get
(
'stationIdsList'
,[])
if
not
exitAssigned
:
for
obj
in
G
.
ObjList
:
exitId
=
None
for
elementId
in
elementIds
:
for
obj
in
G
.
ObjList
:
if
obj
.
id
==
elementId
and
obj
.
type
==
'Exit'
:
if
obj
.
type
==
'Exit'
:
exitAssigned
=
True
exitId
=
obj
.
id
if
not
exitAssigned
:
break
exitId
=
None
if
exitId
:
for
obj
in
G
.
ObjList
:
# route.append([exitId, 0])
if
obj
.
type
==
'Exit'
:
route
.
append
({
'stationIdsList'
:[
str
(
exitId
)],
\
exitId
=
obj
.
id
'processingTime'
:{}})
break
if
exitId
:
# initiate the OrderComponent
# route.append([exitId, 0])
OC
=
OrderComponent
(
id
,
name
,
route
,
\
route
.
append
({
'stationIdsList'
:[
str
(
exitId
)],
\
priority
=
self
.
orderToBeDecomposed
.
priority
,
\
'processingTime'
:{}})
dueDate
=
self
.
orderToBeDecomposed
.
dueDate
,
\
componentType
=
componentType
,
\
# initiate the OrderComponent
requestingComponent
=
requestingComponent
,
\
OC
=
OrderComponent
(
id
,
name
,
route
,
\
order
=
self
.
orderToBeDecomposed
,
\
priority
=
self
.
orderToBeDecomposed
.
priority
,
\
orderDate
=
self
.
orderToBeDecomposed
.
orderDate
,
\
dueDate
=
self
.
orderToBeDecomposed
.
dueDate
,
\
extraPropertyDict
=
extraPropertyDict
,
\
componentType
=
componentType
,
\
isCritical
=
self
.
orderToBeDecomposed
.
isCritical
)
requestingComponent
=
requestingComponent
,
\
order
=
self
.
orderToBeDecomposed
,
\
# check the componentType of the component and accordingly add to the corresponding list of the parent order
orderDate
=
self
.
orderToBeDecomposed
.
orderDate
,
\
if
OC
.
componentType
==
'Basic'
:
extraPropertyDict
=
extraPropertyDict
,
\
self
.
orderToBeDecomposed
.
basicComponentsList
.
append
(
OC
)
isCritical
=
self
.
orderToBeDecomposed
.
isCritical
)
elif
OC
.
componentType
==
'Secondary'
:
self
.
orderToBeDecomposed
.
secondaryComponentsList
.
append
(
OC
)
# check the componentType of the component and accordingly add to the corresponding list of the parent order
else
:
if
OC
.
componentType
==
'Basic'
:
self
.
orderToBeDecomposed
.
auxiliaryComponentsList
.
append
(
OC
)
self
.
orderToBeDecomposed
.
basicComponentsList
.
append
(
OC
)
elif
OC
.
componentType
==
'Secondary'
:
G
.
OrderComponentList
.
append
(
OC
)
self
.
orderToBeDecomposed
.
secondaryComponentsList
.
append
(
OC
)
G
.
JobList
.
append
(
OC
)
else
:
G
.
WipList
.
append
(
OC
)
self
.
orderToBeDecomposed
.
auxiliaryComponentsList
.
append
(
OC
)
G
.
EntityList
.
append
(
OC
)
self
.
newlyCreatedComponents
.
append
(
OC
)
#keep these to pass them to setWIP
G
.
OrderComponentList
.
append
(
OC
)
OC
.
initialize
()
#initialize the component
G
.
JobList
.
append
(
OC
)
G
.
WipList
.
append
(
OC
)
\ No newline at end of file
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