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
f52fa83f
Commit
f52fa83f
authored
Aug 22, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Jobs definition in the new way. 3 tests fail
parent
37a13947
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
109 additions
and
196 deletions
+109
-196
dream/simulation/CapacityEntity.py
dream/simulation/CapacityEntity.py
+1
-1
dream/simulation/Entity.py
dream/simulation/Entity.py
+11
-5
dream/simulation/JSONInputs/Topology26.json
dream/simulation/JSONInputs/Topology26.json
+15
-9
dream/simulation/JSONInputs/Topology34.json
dream/simulation/JSONInputs/Topology34.json
+10
-0
dream/simulation/JSONInputs/Topology35.json
dream/simulation/JSONInputs/Topology35.json
+10
-0
dream/simulation/JSONInputs/Topology39.json
dream/simulation/JSONInputs/Topology39.json
+1
-1
dream/simulation/JSONInputs/Topology45.json
dream/simulation/JSONInputs/Topology45.json
+10
-0
dream/simulation/JSONInputs/Topology60.json
dream/simulation/JSONInputs/Topology60.json
+25
-0
dream/simulation/JSONInputs/Topology69.json
dream/simulation/JSONInputs/Topology69.json
+10
-0
dream/simulation/Job.py
dream/simulation/Job.py
+4
-7
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+8
-170
dream/simulation/Order.py
dream/simulation/Order.py
+2
-0
dream/simulation/OrderComponent.py
dream/simulation/OrderComponent.py
+2
-3
No files found.
dream/simulation/CapacityEntity.py
View file @
f52fa83f
...
...
@@ -34,7 +34,7 @@ from Entity import Entity
class
CapacityEntity
(
Entity
):
type
=
"CapacityEntity"
def
__init__
(
self
,
id
=
None
,
name
=
None
,
capacityProjectId
=
None
,
requiredCapacity
=
10
,
priority
=
0
,
dueDate
=
None
,
orderDate
=
None
,
isCritical
=
False
):
def
__init__
(
self
,
id
=
None
,
name
=
None
,
capacityProjectId
=
None
,
requiredCapacity
=
10
,
priority
=
0
,
dueDate
=
0
,
orderDate
=
0
,
isCritical
=
False
):
Entity
.
__init__
(
self
,
id
,
name
,
priority
,
dueDate
,
orderDate
,
isCritical
)
self
.
capacityProjectId
=
capacityProjectId
# the project id hat the capacity Entity is part of
self
.
capacityProject
=
None
# the project that the capacity Entity is part of. It is defined in initialize
...
...
dream/simulation/Entity.py
View file @
f52fa83f
...
...
@@ -34,7 +34,7 @@ import simpy
class
Entity
(
object
):
type
=
"Entity"
def
__init__
(
self
,
id
=
None
,
name
=
None
,
priority
=
0
,
dueDate
=
None
,
orderDate
=
None
,
def
__init__
(
self
,
id
=
None
,
name
=
None
,
priority
=
0
,
dueDate
=
0
,
orderDate
=
0
,
isCritical
=
False
,
remainingProcessingTime
=
0
):
self
.
name
=
name
self
.
id
=
id
...
...
@@ -48,16 +48,21 @@ class Entity(object):
self
.
height
=
1.0
self
.
length
=
1.0
# information concerning the sorting of the entities inside (for example) queues
self
.
priority
=
priority
self
.
dueDate
=
dueDate
self
.
orderDate
=
orderDate
self
.
priority
=
float
(
priority
)
self
.
dueDate
=
float
(
dueDate
)
self
.
orderDate
=
float
(
orderDate
)
# a list that holds information about the schedule
# of the entity (when it enters and exits every station)
self
.
schedule
=
[]
self
.
currentStation
=
None
# values to be used in the internal processing of compoundObjects
self
.
internal
=
False
# informs if the entity is being processed internally
self
.
isCritical
=
isCritical
# flag to inform weather the entity is critical -> preemption
if
isinstance
(
isCritical
,
unicode
):
self
.
isCritical
=
bool
(
int
(
isCritical
))
elif
isinstance
(
isCritical
,
int
):
self
.
isCritical
=
bool
(
isCritical
)
# flag to inform weather the entity is critical -> preemption
else
:
self
.
isCritical
=
isCritical
self
.
manager
=
None
# default value
self
.
numberOfUnits
=
1
# default value
# variable used to differentiate entities with and entities without routes
...
...
@@ -70,6 +75,7 @@ class Entity(object):
# alias used for printing the Route
self
.
alias
=
None
self
.
remainingProcessingTime
=
remainingProcessingTime
print
self
.
id
# =======================================================================
# outputs results to JSON File
...
...
dream/simulation/JSONInputs/Topology26.json
View file @
f52fa83f
...
...
@@ -72,11 +72,8 @@
"wip"
:
[
{
"_class"
:
"Dream.Job"
,
"due_date"
:
"2013-12-15"
,
"id"
:
"J1"
,
"material"
:
"Plastic"
,
"name"
:
"Order 1 from X"
,
"order_date"
:
"2013-11-20"
,
"priority"
:
"2"
,
"route"
:
[
{
...
...
@@ -114,6 +111,11 @@
"stationIdsList"
:
[
"M3"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
@@ -127,11 +129,8 @@
"wip"
:
[
{
"_class"
:
"Dream.Job"
,
"due_date"
:
"2013-11-30"
,
"id"
:
"J2"
,
"material"
:
"Aluminium"
,
"name"
:
"Order 2 from Y"
,
"order_date"
:
"2013-11-14"
,
"priority"
:
"1"
,
"route"
:
[
{
...
...
@@ -169,6 +168,11 @@
"stationIdsList"
:
[
"M1"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
@@ -182,11 +186,8 @@
"wip"
:
[
{
"_class"
:
"Dream.Job"
,
"due_date"
:
"2014-02-01"
,
"id"
:
"J3"
,
"material"
:
"Plastic"
,
"name"
:
"Order 3 from Z"
,
"order_date"
:
"2013-11-03"
,
"priority"
:
"3"
,
"route"
:
[
{
...
...
@@ -224,6 +225,11 @@
"stationIdsList"
:
[
"M1"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
dream/simulation/JSONInputs/Topology34.json
View file @
f52fa83f
...
...
@@ -85,6 +85,11 @@
"stationIdsList"
:
[
"M2"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
@@ -120,6 +125,11 @@
"stationIdsList"
:
[
"M2"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
dream/simulation/JSONInputs/Topology35.json
View file @
f52fa83f
...
...
@@ -85,6 +85,11 @@
"stationIdsList"
:
[
"M2"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
@@ -120,6 +125,11 @@
"stationIdsList"
:
[
"M2"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
dream/simulation/JSONInputs/Topology39.json
View file @
f52fa83f
...
...
@@ -6,7 +6,7 @@
"confidenceLevel"
:
"0.95"
,
"maxSimTime"
:
"-1"
,
"numberOfReplications"
:
"1"
,
"trace"
:
"
No
"
"trace"
:
"
Yes
"
},
"nodes"
:
{
"AB1"
:
{
...
...
dream/simulation/JSONInputs/Topology45.json
View file @
f52fa83f
...
...
@@ -137,6 +137,11 @@
"stationIdsList"
:
[
"M2"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
@@ -197,6 +202,11 @@
"stationIdsList"
:
[
"M4"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
dream/simulation/JSONInputs/Topology60.json
View file @
f52fa83f
...
...
@@ -136,6 +136,11 @@
"stationIdsList"
:
[
"EDM"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
},
...
...
@@ -181,6 +186,11 @@
"stationIdsList"
:
[
"EDM"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
},
...
...
@@ -226,6 +236,11 @@
"stationIdsList"
:
[
"EDM"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
},
...
...
@@ -271,6 +286,11 @@
"stationIdsList"
:
[
"EDM"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
},
...
...
@@ -297,6 +317,11 @@
"stationIdsList"
:
[
"M1"
]
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
dream/simulation/JSONInputs/Topology69.json
View file @
f52fa83f
...
...
@@ -96,6 +96,11 @@
"M2"
],
"stepNumber"
:
"3"
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
@@ -133,6 +138,11 @@
"M2"
],
"stepNumber"
:
"1"
},
{
"stationIdsList"
:
[
"E1"
]
}
]
}
...
...
dream/simulation/Job.py
View file @
f52fa83f
...
...
@@ -36,7 +36,7 @@ class Job(Entity): # inherits from the Entity c
type
=
'Job'
family
=
'Job'
def
__init__
(
self
,
id
=
None
,
name
=
None
,
route
=
[],
priority
=
0
,
dueDate
=
None
,
orderDate
=
None
,
extraPropertyDict
=
None
,
isCritical
=
False
):
def
__init__
(
self
,
id
=
None
,
name
=
None
,
route
=
[],
priority
=
0
,
dueDate
=
0
,
orderDate
=
0
,
extraPropertyDict
=
None
,
isCritical
=
False
):
Entity
.
__init__
(
self
,
id
=
id
,
name
=
name
,
priority
=
priority
,
dueDate
=
dueDate
,
orderDate
=
orderDate
,
isCritical
=
isCritical
)
# instance specific attributes
# information on the routing and the stops of the entity
...
...
@@ -44,9 +44,6 @@ class Job(Entity): # inherits from the Entity c
# also contains the processing times in each station
self
.
remainingRoute
=
list
(
route
)
# the remaining route. in the beginning
# this should be the same as the full route
# the scheduling of the entity as resolved by the simulation
# self.schedule=[] # keeps the result of the simulation.
# # A list with the stations and time of entrance
self
.
extraPropertyDict
=
extraPropertyDict
# variable used to differentiate entities with and entities without routes
self
.
family
=
'Job'
...
...
dream/simulation/LineGenerationJSON.py
View file @
f52fa83f
...
...
@@ -373,166 +373,13 @@ def createWIP():
entityType
=
Globals
.
getClassFromName
(
entityClass
)
inputDict
=
dict
(
entity
)
inputDict
.
pop
(
'_class'
)
if
entityClass
in
[
'Dream.CapacityEntity'
,
'Dream.CapacityProject'
,
'Dream.Part'
,
'Dream.Batch'
,
'Dream.SubBatch'
]:
'Dream.Batch'
,
'Dream.SubBatch'
,
'Dream.Job'
,
'Dream.Mould'
,
'Dream.OrderComponent'
]:
entity
=
entityType
(
**
inputDict
)
G
.
EntityList
.
append
(
entity
)
object
=
Globals
.
findObjectById
(
element
[
'id'
])
entity
.
currentStation
=
object
elif
entityClass
==
'Dream.OrderComponent'
:
id
=
entity
.
get
(
'id'
,
'not found'
)
name
=
entity
.
get
(
'name'
,
'not found'
)
priority
=
int
(
entity
.
get
(
'priority'
,
'0'
))
dueDate
=
float
(
entity
.
get
(
'dueDate'
,
'0'
))
orderDate
=
float
(
entity
.
get
(
'orderDate'
,
'0'
))
componentType
=
entity
.
get
(
'componentType'
,
'not found'
)
isCritical
=
bool
(
int
(
entity
.
get
(
'isCritical'
,
'0'
)))
readyForAssembly
=
bool
(
int
(
entity
.
get
(
'readyForAssembly'
,
'0'
)))
JSONRoute
=
entity
.
get
(
'route'
,
[])
# dummy variable that holds the routes of the jobs
# the route from the JSON file
# is a sequence of dictionaries
route
=
[
x
for
x
in
JSONRoute
]
# copy JSONRoute
# keep a reference of all extra properties passed to the job
extraPropertyDict
=
{}
for
key
,
value
in
entity
.
items
():
if
key
not
in
(
'_class'
,
'id'
):
extraPropertyDict
[
key
]
=
value
# if there is an exit assigned to the component
# update the corresponding local flag
# TODO: have to talk about it with NEX
exitAssigned
=
False
for
element
in
route
:
elementIds
=
element
.
get
(
'stationIdsList'
,[])
for
obj
in
G
.
ObjList
:
for
elementId
in
elementIds
:
if
obj
.
id
==
elementId
and
obj
.
type
==
'Exit'
:
exitAssigned
=
True
# Below it is to assign assemblers if there are any in the corresponding Global list
if
not
exitAssigned
:
if
len
(
G
.
MouldAssemblyList
)
!=
0
:
bufferIDlist
=
[]
assemblerIDlist
=
[]
for
assemblyBuffer
in
G
.
MouldAssemblyBufferList
:
bufferIDlist
.
append
(
str
(
assemblyBuffer
.
id
))
for
assembler
in
G
.
MouldAssemblyList
:
assemblerIDlist
.
append
(
str
(
assembler
.
id
))
route
.
append
({
'stationIdsList'
:
bufferIDlist
})
# assign MouldAssemblyBuffers
route
.
append
({
'stationIdsList'
:
assemblerIDlist
})
# assign MouldAssemblies
# if assemblers are assigned then an 'exit' is assigned
exitAssigned
=
True
#Below it is to assign an exit if it was not assigned in JSON and no assemblers are already assigned
if
not
exitAssigned
:
exitId
=
None
for
obj
in
G
.
ObjList
:
if
obj
.
type
==
'Exit'
:
exitId
=
obj
.
id
break
if
exitId
:
route
.
append
({
'stationIdsList'
:[
exitId
],
\
'processingTime'
:{}})
# initiate the job
OC
=
OrderComponent
(
id
,
name
,
route
,
priority
=
priority
,
dueDate
=
dueDate
,
orderDate
=
orderDate
,
componentType
=
componentType
,
readyForAssembly
=
readyForAssembly
,
isCritical
=
isCritical
,
extraPropertyDict
=
extraPropertyDict
)
G
.
OrderComponentList
.
append
(
OC
)
G
.
JobList
.
append
(
OC
)
G
.
WipList
.
append
(
OC
)
G
.
EntityList
.
append
(
OC
)
elif
entityClass
==
'Dream.Mould'
:
id
=
entity
.
get
(
'id'
,
'not found'
)
name
=
entity
.
get
(
'name'
,
'not found'
)
priority
=
int
(
entity
.
get
(
'priority'
,
'0'
))
dueDate
=
float
(
entity
.
get
(
'dueDate'
,
'0'
))
orderDate
=
float
(
entity
.
get
(
'orderDate'
,
'0'
))
isCritical
=
bool
(
int
(
entity
.
get
(
'isCritical'
,
'0'
)))
JSONRoute
=
entity
.
get
(
'route'
,
[])
# dummy variable that holds the routes of the jobs
# the route from the JSON file
# is a sequence of dictionaries
route
=
[
x
for
x
in
JSONRoute
]
# copy JSONRoute
# keep a reference of all extra properties passed to the job
extraPropertyDict
=
{}
for
key
,
value
in
entity
.
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'
:[
exitId
],
\
'processingTime'
:{}})
# initiate the job
M
=
Mould
(
id
,
name
,
route
,
priority
=
priority
,
dueDate
=
dueDate
,
orderDate
=
orderDate
,
isCritical
=
isCritical
,
extraPropertyDict
=
extraPropertyDict
)
G
.
MouldList
.
append
(
M
)
G
.
JobList
.
append
(
M
)
G
.
WipList
.
append
(
M
)
G
.
EntityList
.
append
(
M
)
elif
entityClass
==
'Dream.Job'
:
id
=
entity
.
get
(
'id'
,
'not found'
)
name
=
entity
.
get
(
'name'
,
'not found'
)
priority
=
int
(
entity
.
get
(
'priority'
,
'0'
))
dueDate
=
float
(
entity
.
get
(
'dueDate'
,
'0'
))
orderDate
=
float
(
entity
.
get
(
'orderDate'
,
'0'
))
JSONRoute
=
entity
.
get
(
'route'
,
[])
# dummy variable that holds the routes of the jobs
# the route from the JSON file
# is a sequence of dictionaries
route
=
[
x
for
x
in
JSONRoute
]
# copy JSONRoute
# keep a reference of all extra properties passed to the job
extraPropertyDict
=
{}
for
key
,
value
in
entity
.
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
:
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'
:[
exitId
],
\
'processingTime'
:{}})
# initiate the job
J
=
Job
(
id
,
name
,
route
,
priority
=
priority
,
dueDate
=
dueDate
,
orderDate
=
orderDate
,
extraPropertyDict
=
extraPropertyDict
)
G
.
JobList
.
append
(
J
)
G
.
WipList
.
append
(
J
)
G
.
EntityList
.
append
(
J
)
if
entityClass
==
'Dream.Order'
:
id
=
entity
.
get
(
'id'
,
'not found'
)
...
...
@@ -585,7 +432,7 @@ def createWIP():
'processingTime'
:
\
{
'distributionType'
:
'Fixed'
,
\
'mean'
:
'0'
}})
# XXX d
u
rty way to implement new approach were the order is abstract and does not run through the system
# XXX d
i
rty way to implement new approach were the order is abstract and does not run through the system
# but the OrderDesign does
# XXX initiate the Order and the OrderDesign
O
=
Order
(
'G'
+
id
,
'general '
+
name
,
route
=
[],
priority
=
priority
,
dueDate
=
dueDate
,
orderDate
=
orderDate
,
...
...
@@ -787,19 +634,10 @@ def main(argv=[], input_data=None):
G
.
outputJSON
[
'general'
][
'totalExecutionTime'
]
=
(
time
.
time
()
-
start
);
G
.
outputJSON
[
'elementList'
]
=
[];
#output data to JSON for every object in the topology
for
element
in
G
.
ObjList
:
element
.
outputResultsJSON
()
#output data to JSON for every resource in the topology
for
model_resource
in
G
.
ObjectResourceList
:
model_resource
.
outputResultsJSON
()
for
job
in
G
.
JobList
:
job
.
outputResultsJSON
()
for
capacityProject
in
G
.
CapacityProjectList
:
capacityProject
.
outputResultsJSON
()
#output data to JSON for every object in the topology
for
object
in
G
.
ObjectResourceList
+
G
.
EntityList
+
G
.
ObjList
:
object
.
outputResultsJSON
()
outputJSONString
=
json
.
dumps
(
G
.
outputJSON
,
indent
=
True
)
G
.
outputJSONFile
.
write
(
outputJSONString
)
...
...
dream/simulation/Order.py
View file @
f52fa83f
...
...
@@ -62,3 +62,5 @@ class Order(Job):
# used by printRoute
self
.
alias
=
'O'
+
str
(
len
(
G
.
OrderList
))
def
createRoute
(
self
,
route
):
return
route
\ No newline at end of file
dream/simulation/OrderComponent.py
View file @
f52fa83f
...
...
@@ -37,8 +37,8 @@ class OrderComponent(Job): # inherits from the
def
__init__
(
self
,
id
=
None
,
name
=
None
,
route
=
[],
priority
=
0
,
dueDate
=
None
,
orderDate
=
None
,
dueDate
=
0
,
orderDate
=
0
,
extraPropertyDict
=
None
,
componentType
=
'Basic'
,
order
=
None
,
...
...
@@ -66,4 +66,3 @@ class OrderComponent(Job): # inherits from the
# used by printRoute
if
self
.
order
:
self
.
alias
=
self
.
order
.
alias
+
'C'
+
str
(
len
(
G
.
OrderComponentList
))
\ 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