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
430b6d15
Commit
430b6d15
authored
Aug 21, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
assembly and dismantle
parent
c8dbdb45
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
59 deletions
+92
-59
dream/simulation/Assembly.py
dream/simulation/Assembly.py
+46
-20
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+39
-13
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+6
-25
dream/simulation/Machine.py
dream/simulation/Machine.py
+1
-1
No files found.
dream/simulation/Assembly.py
View file @
430b6d15
...
...
@@ -41,9 +41,25 @@ class Assembly(CoreObject):
#===========================================================================
# initialize the object
#===========================================================================
def
__init__
(
self
,
id
,
name
,
processingTime
=
None
):
from
Globals
import
G
self
.
env
=
G
.
env
def
__init__
(
self
,
id
=
''
,
name
=
''
,
processingTime
=
None
,
inputsDict
=
None
):
self
.
type
=
"Assembly"
#String that shows the type of object
self
.
next
=
[]
#list with the next objects in the flow
self
.
previous
=
[]
#list with the previous objects in the flow
self
.
previousPart
=
[]
#list with the previous objects that send parts
self
.
previousFrame
=
[]
#list with the previous objects that send frames
self
.
nextIds
=
[]
#list with the ids of the next objects in the flow
self
.
previousIds
=
[]
#list with the ids of the previous objects in the flow
#lists to hold statistics of multiple runs
self
.
Waiting
=
[]
self
.
Working
=
[]
self
.
Blockage
=
[]
# if input is given in a dictionary
if
inputsDict
:
CoreObject
.
__init__
(
self
,
inputsDict
=
inputsDict
)
# else read the separate ones
else
:
if
not
processingTime
:
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0
,
...
...
@@ -55,29 +71,39 @@ class Assembly(CoreObject):
processingTime
[
'max'
]
=
float
(
processingTime
[
'mean'
])
+
5
*
float
(
processingTime
[
'stdev'
])
CoreObject
.
__init__
(
self
,
id
,
name
)
self
.
type
=
"Assembly"
#String that shows the type of object
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
self
.
next
=
[]
#list with the next objects in the flow
self
.
previous
=
[]
#list with the previous objects in the flow
self
.
previousPart
=
[]
#list with the previous objects that send parts
self
.
previousFrame
=
[]
#list with the previous objects that send frames
self
.
nextIds
=
[]
#list with the ids of the next objects in the flow
self
.
previousIds
=
[]
#list with the ids of the previous objects in the flow
# XXX previousFrameIds and previousPartIds are not used
self
.
previousPartIds
=
[]
#list with the ids of the previous objects in the flow that bring parts
self
.
previousFrameIds
=
[]
#list with the ids of the previous objects in the flow that bring frames
# ============================== variable that is used for the loading of machines =============
self
.
exitAssignedToReceiver
=
False
# by default the objects are not blocked
# when the entities have to be loaded to operatedMachines
# then the giverObjects have to be blocked for the time
# that the machine is being loaded
#lists to hold statistics of multiple runs
self
.
Waiting
=
[]
self
.
Working
=
[]
self
.
Blockage
=
[]
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
CoreObject
.
parseInputs
(
self
,
inputsDict
)
processingTime
=
inputsDict
.
get
(
'processingTime'
,{})
if
not
processingTime
:
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0
,
'stdev'
:
0
,
'min'
:
0
,
}
if
processingTime
[
'distributionType'
]
==
'Normal'
and
\
processingTime
.
get
(
'max'
,
None
)
is
None
:
processingTime
[
'max'
]
=
float
(
processingTime
[
'mean'
])
+
5
*
float
(
processingTime
[
'stdev'
])
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
# ============================== variable that is used for the loading of machines =============
self
.
exitAssignedToReceiver
=
False
# by default the objects are not blocked
# when the entities have to be loaded to operatedMachines
# then the giverObjects have to be blocked for the time
# that the machine is being loaded
from
Globals
import
G
G
.
AssemblyList
.
append
(
self
)
#===========================================================================
# initialize method
...
...
dream/simulation/Dismantle.py
View file @
430b6d15
...
...
@@ -23,7 +23,7 @@ Created on 21 May 2013
@author: George
'''
'''
Models a di
c
mantle object
Models a di
s
mantle object
it gathers frames that have parts loaded, unloads the parts and sends the frame to one destination and the parts to another
'''
...
...
@@ -42,18 +42,9 @@ class Dismantle(CoreObject):
#===========================================================================
# initialize the object
#===========================================================================
def
__init__
(
self
,
id
,
name
,
distribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0.1
,
min
=
0
,
max
=
5
):
CoreObject
.
__init__
(
self
,
id
,
name
)
from
Globals
import
G
self
.
env
=
G
.
env
self
.
type
=
"Dismantle"
#String that shows the type of object
self
.
distType
=
distribution
#the distribution that the procTime follows
self
.
rng
=
RandomNumberGenerator
(
self
,
self
.
distType
)
self
.
rng
.
mean
=
mean
self
.
rng
.
stdev
=
stdev
self
.
rng
.
min
=
min
self
.
rng
.
max
=
max
def
__init__
(
self
,
id
=
''
,
name
=
''
,
processingTime
=
None
,
inputsDict
=
{}):
self
.
type
=
'Dismantle'
self
.
previous
=
[]
#list with the previous objects in the flow
self
.
previousIds
=
[]
#list with the ids of the previous objects in the flow
self
.
nextPart
=
[]
#list with the next objects that receive parts
...
...
@@ -73,12 +64,47 @@ class Dismantle(CoreObject):
# when the entities have to be loaded to operatedMachines
# then the giverObjects have to be blocked for the time
# that the machine is being loaded
if
inputsDict
:
CoreObject
.
__init__
(
self
,
inputsDict
=
inputsDict
)
else
:
CoreObject
.
__init__
(
self
,
id
,
name
)
from
Globals
import
G
if
not
processingTime
:
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0
,
'stdev'
:
0
,
'min'
:
0
,
}
if
processingTime
[
'distributionType'
]
==
'Normal'
and
\
processingTime
.
get
(
'max'
,
None
)
is
None
:
processingTime
[
'max'
]
=
float
(
processingTime
[
'mean'
])
+
5
*
float
(
processingTime
[
'stdev'
])
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
CoreObject
.
parseInputs
(
self
,
inputsDict
)
processingTime
=
inputsDict
.
get
(
'processingTime'
,{})
from
Globals
import
G
if
not
processingTime
:
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0
,
'stdev'
:
0
,
'min'
:
0
,
}
if
processingTime
[
'distributionType'
]
==
'Normal'
and
\
processingTime
.
get
(
'max'
,
None
)
is
None
:
processingTime
[
'max'
]
=
float
(
processingTime
[
'mean'
])
+
5
*
float
(
processingTime
[
'stdev'
])
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
G
.
DismantleList
.
append
(
self
)
#===========================================================================
# the initialize method
#===========================================================================
def
initialize
(
self
):
# Process.__init__(self)
CoreObject
.
initialize
(
self
)
self
.
waitToDispose
=
False
#flag that shows if the object waits to dispose an entity
self
.
waitToDisposePart
=
False
#flag that shows if the object waits to dispose a part
...
...
dream/simulation/LineGenerationJSON.py
View file @
430b6d15
...
...
@@ -293,34 +293,15 @@ def createObjects():
elif
objClass
in
[
'Dream.Machine'
,
'Dream.BatchScrapMachine'
,
'Dream.M3'
,
'Dream.MachineJobShop'
,
'Dream.MachineManagedJob'
,
'Dream.MouldAssembly'
,
'Dream.Exit'
,
'Dream.ExitJobShop'
,
'Dream.Queue'
,
'Dream.RoutingQueue'
,
'Dream.QueueJobShop'
,
'Dream.QueueManagedJob'
]:
'Dream.Queue'
,
'Dream.RoutingQueue'
,
'Dream.QueueJobShop'
,
'Dream.QueueManagedJob'
,
'Dream.Assembly'
,
'Dream.Dismantle'
]:
objectType
=
Globals
.
getClassFromName
(
objClass
)
coreObject
=
objectType
(
inputsDict
=
element
)
coreObject
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
# update the nextIDs list of the machine
elif
objClass
==
'Dream.Assembly'
:
A
=
Assembly
(
**
element
)
A
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
G
.
AssemblyList
.
append
(
A
)
G
.
ObjList
.
append
(
A
)
elif
objClass
==
'Dream.Dismantle'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
processingTime
=
element
.
get
(
'processingTime'
,
{})
distributionType
=
processingTime
.
get
(
'distributionType'
,
'not found'
)
mean
=
float
(
processingTime
.
get
(
'mean'
)
or
0
)
stdev
=
float
(
processingTime
.
get
(
'stdev'
)
or
0
)
min
=
float
(
processingTime
.
get
(
'min'
)
or
0
)
max
=
float
(
processingTime
.
get
(
'max'
)
or
mean
+
5
*
stdev
)
D
=
Dismantle
(
id
,
name
,
distribution
=
distributionType
,
mean
=
mean
,
stdev
=
stdev
,
min
=
min
,
max
=
max
)
# get the successorList for the 'Parts'
D
.
nextPartIds
=
getSuccessorList
(
id
,
lambda
source
,
destination
,
edge_data
:
edge_data
.
get
(
'entity'
)
==
'Part'
)
coreObject
.
nextPartIds
=
getSuccessorList
(
element
[
'id'
]
,
lambda
source
,
destination
,
edge_data
:
edge_data
.
get
(
'entity'
)
==
'Part'
)
# get the successorList for the 'Frames'
D
.
nextFrameIds
=
getSuccessorList
(
id
,
lambda
source
,
destination
,
edge_data
:
edge_data
.
get
(
'entity'
)
==
'Frame'
)
D
.
nextIds
=
getSuccessorList
(
id
)
G
.
DismantleList
.
append
(
D
)
G
.
ObjList
.
append
(
D
)
coreObject
.
nextFrameIds
=
getSuccessorList
(
element
[
'id'
],
lambda
source
,
destination
,
edge_data
:
edge_data
.
get
(
'entity'
)
==
'Frame'
)
coreObject
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
# update the nextIDs list of the machine
elif
objClass
==
'Dream.Conveyer'
:
id
=
element
.
get
(
'id'
,
'not found'
)
...
...
dream/simulation/Machine.py
View file @
430b6d15
...
...
@@ -54,7 +54,7 @@ class Machine(CoreObject):
operatorPool
=
'None'
,
operationType
=
'None'
,
\
setupTime
=
None
,
loadTime
=
None
,
isPreemptive
=
False
,
resetOnPreemption
=
False
,
canDeliverOnInterruption
=
False
,
inputsDict
=
{}):
canDeliverOnInterruption
=
False
,
inputsDict
=
{}
,
failures
=
None
):
self
.
type
=
"Machine"
#String that shows the type of object
# if input is given in a dictionary
if
inputsDict
:
...
...
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