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
8f437377
Commit
8f437377
authored
Aug 21, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start using ** attr
parent
430b6d15
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
204 deletions
+53
-204
dream/simulation/Assembly.py
dream/simulation/Assembly.py
+2
-0
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+2
-11
dream/simulation/Exit.py
dream/simulation/Exit.py
+3
-12
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+10
-9
dream/simulation/Machine.py
dream/simulation/Machine.py
+19
-119
dream/simulation/Queue.py
dream/simulation/Queue.py
+14
-52
dream/simulation/Source.py
dream/simulation/Source.py
+3
-1
No files found.
dream/simulation/Assembly.py
View file @
8f437377
...
@@ -78,6 +78,8 @@ class Assembly(CoreObject):
...
@@ -78,6 +78,8 @@ class Assembly(CoreObject):
# when the entities have to be loaded to operatedMachines
# when the entities have to be loaded to operatedMachines
# then the giverObjects have to be blocked for the time
# then the giverObjects have to be blocked for the time
# that the machine is being loaded
# that the machine is being loaded
from
Globals
import
G
G
.
AssemblyList
.
append
(
self
)
# =======================================================================
# =======================================================================
# parses inputs if they are given in a dictionary
# parses inputs if they are given in a dictionary
...
...
dream/simulation/CoreObject.py
View file @
8f437377
...
@@ -34,7 +34,7 @@ import simpy
...
@@ -34,7 +34,7 @@ import simpy
class
CoreObject
(
object
):
class
CoreObject
(
object
):
class_name
=
'Dream.CoreObject'
class_name
=
'Dream.CoreObject'
def
__init__
(
self
,
id
=
''
,
name
=
''
,
inputsDict
=
{},
**
kw
):
def
__init__
(
self
,
id
,
name
,
inputsDict
=
{},
**
kw
):
self
.
id
=
id
self
.
id
=
id
self
.
objName
=
name
self
.
objName
=
name
# lists that hold the previous and next objects in the flow
# lists that hold the previous and next objects in the flow
...
@@ -68,18 +68,9 @@ class CoreObject(object):
...
@@ -68,18 +68,9 @@ class CoreObject(object):
self
.
station_col_inds
=
[]
self
.
station_col_inds
=
[]
self
.
op_col_indx
=
None
self
.
op_col_indx
=
None
# if there is input in a dictionary parse from it
# if there is input in a dictionary parse from it
if
inputsDict
:
self
.
parseInputs
(
inputsDict
)
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
self
.
id
=
inputsDict
.
get
(
'id'
)
self
.
objName
=
inputsDict
.
get
(
'name'
)
from
Globals
import
G
from
Globals
import
G
G
.
ObjList
.
append
(
self
)
# add object to ObjList
G
.
ObjList
.
append
(
self
)
# add object to ObjList
def
initialize
(
self
):
def
initialize
(
self
):
from
Globals
import
G
from
Globals
import
G
self
.
env
=
G
.
env
self
.
env
=
G
.
env
...
...
dream/simulation/Exit.py
View file @
8f437377
...
@@ -45,19 +45,10 @@ class Exit(CoreObject):
...
@@ -45,19 +45,10 @@ class Exit(CoreObject):
self
.
Lifespan
=
[]
self
.
Lifespan
=
[]
self
.
TaktTime
=
[]
self
.
TaktTime
=
[]
# if input is given in a dictionary
# if input is given in a dictionary
if
inputsDict
:
CoreObject
.
__init__
(
self
,
id
,
name
)
CoreObject
.
__init__
(
self
,
inputsDict
=
inputsDict
)
else
:
CoreObject
.
__init__
(
self
,
id
,
name
)
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
CoreObject
.
parseInputs
(
self
,
inputsDict
)
from
Globals
import
G
from
Globals
import
G
G
.
ExitList
.
append
(
self
)
G
.
ExitList
.
append
(
self
)
def
initialize
(
self
):
def
initialize
(
self
):
# using the Process __init__ and not the CoreObject __init__
# using the Process __init__ and not the CoreObject __init__
CoreObject
.
initialize
(
self
)
CoreObject
.
initialize
(
self
)
...
...
dream/simulation/LineGenerationJSON.py
View file @
8f437377
...
@@ -278,12 +278,6 @@ def createObjects():
...
@@ -278,12 +278,6 @@ def createObjects():
element
.
pop
(
k
,
None
)
element
.
pop
(
k
,
None
)
objClass
=
element
.
pop
(
'_class'
)
objClass
=
element
.
pop
(
'_class'
)
if
objClass
==
'Dream.Source'
:
S
=
Source
(
**
element
)
S
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
G
.
SourceList
.
append
(
S
)
G
.
ObjList
.
append
(
S
)
if
objClass
==
'Dream.BatchSource'
:
if
objClass
==
'Dream.BatchSource'
:
S
=
BatchSource
(
**
element
)
S
=
BatchSource
(
**
element
)
S
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
S
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
...
@@ -294,14 +288,21 @@ def createObjects():
...
@@ -294,14 +288,21 @@ def createObjects():
elif
objClass
in
[
'Dream.Machine'
,
'Dream.BatchScrapMachine'
,
'Dream.M3'
,
'Dream.MachineJobShop'
,
elif
objClass
in
[
'Dream.Machine'
,
'Dream.BatchScrapMachine'
,
'Dream.M3'
,
'Dream.MachineJobShop'
,
'Dream.MachineManagedJob'
,
'Dream.MouldAssembly'
,
'Dream.Exit'
,
'Dream.ExitJobShop'
,
'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'
]:
'Dream.Assembly'
,
'Dream.Dismantle'
,
'Dream.Source'
]:
inputDict
=
dict
(
element
)
if
'wip'
in
inputDict
:
del
inputDict
[
'wip'
]
if
'failures'
in
inputDict
:
del
inputDict
[
'failures'
]
if
'shift'
in
inputDict
:
del
inputDict
[
'shift'
]
objectType
=
Globals
.
getClassFromName
(
objClass
)
objectType
=
Globals
.
getClassFromName
(
objClass
)
coreObject
=
objectType
(
inputsDict
=
elemen
t
)
coreObject
=
objectType
(
**
inputDic
t
)
# get the successorList for the 'Parts'
# get the successorList for the 'Parts'
coreObject
.
nextPartIds
=
getSuccessorList
(
element
[
'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'
# get the successorList for the 'Frames'
coreObject
.
nextFrameIds
=
getSuccessorList
(
element
[
'id'
],
lambda
source
,
destination
,
edge_data
:
edge_data
.
get
(
'entity'
)
==
'Frame'
)
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
coreObject
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
# update the nextIDs list of the
object
elif
objClass
==
'Dream.Conveyer'
:
elif
objClass
==
'Dream.Conveyer'
:
id
=
element
.
get
(
'id'
,
'not found'
)
id
=
element
.
get
(
'id'
,
'not found'
)
...
...
dream/simulation/Machine.py
View file @
8f437377
This diff is collapsed.
Click to expand it.
dream/simulation/Queue.py
View file @
8f437377
...
@@ -39,61 +39,22 @@ class Queue(CoreObject):
...
@@ -39,61 +39,22 @@ class Queue(CoreObject):
#===========================================================================
#===========================================================================
def
__init__
(
self
,
id
=
''
,
name
=
''
,
capacity
=
1
,
isDummy
=
False
,
schedulingRule
=
"FIFO"
,
level
=
None
,
gatherWipStat
=
False
,
inputsDict
=
{}):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
capacity
=
1
,
isDummy
=
False
,
schedulingRule
=
"FIFO"
,
level
=
None
,
gatherWipStat
=
False
,
inputsDict
=
{}):
self
.
type
=
"Queue"
# String that shows the type of object
self
.
type
=
"Queue"
# String that shows the type of object
if
inputsDict
:
CoreObject
.
__init__
(
self
,
id
,
name
)
CoreObject
.
__init__
(
self
,
inputsDict
=
inputsDict
)
# used for the routing of the entities
else
:
# holds the capacity of the Queue
CoreObject
.
__init__
(
self
,
id
,
name
)
# used for the routing of the entities
# holds the capacity of the Queue
if
capacity
>
0
:
self
.
capacity
=
capacity
else
:
self
.
capacity
=
float
(
"inf"
)
# No failures are considered for the Queue
self
.
isDummy
=
isDummy
#Boolean that shows if it is the dummy first Queue
self
.
schedulingRule
=
schedulingRule
#the scheduling rule that the Queue follows
self
.
multipleCriterionList
=
[]
#list with the criteria used to sort the Entities in the Queue
SRlist
=
[
schedulingRule
]
if
schedulingRule
.
startswith
(
"MC"
):
# if the first criterion is MC aka multiple criteria
SRlist
=
schedulingRule
.
split
(
"-"
)
# split the string of the criteria (delimiter -)
self
.
schedulingRule
=
SRlist
.
pop
(
0
)
# take the first criterion of the list
self
.
multipleCriterionList
=
SRlist
# hold the criteria list in the property multipleCriterionList
for
scheduling_rule
in
SRlist
:
if
scheduling_rule
not
in
self
.
getSupportedSchedulingRules
():
raise
ValueError
(
"Unknown scheduling rule %s for %s"
%
(
scheduling_rule
,
id
))
self
.
gatherWipStat
=
gatherWipStat
# Will be populated by an event generator
self
.
wip_stat_list
=
[]
# trigger level for the reallocation of operators
if
level
:
assert
level
<=
self
.
capacity
,
"the level cannot be bigger than the capacity of the queue"
self
.
level
=
level
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
CoreObject
.
parseInputs
(
self
,
inputsDict
)
from
Globals
import
G
G
.
QueueList
.
append
(
self
)
# holds the capacity of the Queue
capacity
=
int
(
inputsDict
.
get
(
'capacity'
)
or
1
)
if
capacity
>
0
:
if
capacity
>
0
:
self
.
capacity
=
capacity
self
.
capacity
=
capacity
else
:
else
:
self
.
capacity
=
float
(
"inf"
)
self
.
capacity
=
float
(
"inf"
)
self
.
isDummy
=
bool
(
int
(
inputsDict
.
get
(
'isDummy'
)
or
0
))
#Boolean that shows if it is the dummy first Queue
# No failures are considered for the Queue
self
.
schedulingRule
=
inputsDict
.
get
(
'schedulingRule'
,
'FIFO'
)
#the scheduling rule that the Queue follows
self
.
isDummy
=
bool
(
int
(
isDummy
))
#Boolean that shows if it is the dummy first Queue
self
.
schedulingRule
=
schedulingRule
#the scheduling rule that the Queue follows
self
.
multipleCriterionList
=
[]
#list with the criteria used to sort the Entities in the Queue
self
.
multipleCriterionList
=
[]
#list with the criteria used to sort the Entities in the Queue
SRlist
=
[
s
elf
.
s
chedulingRule
]
SRlist
=
[
schedulingRule
]
if
s
elf
.
s
chedulingRule
.
startswith
(
"MC"
):
# if the first criterion is MC aka multiple criteria
if
schedulingRule
.
startswith
(
"MC"
):
# if the first criterion is MC aka multiple criteria
SRlist
=
s
elf
.
s
chedulingRule
.
split
(
"-"
)
# split the string of the criteria (delimiter -)
SRlist
=
schedulingRule
.
split
(
"-"
)
# split the string of the criteria (delimiter -)
self
.
schedulingRule
=
SRlist
.
pop
(
0
)
# take the first criterion of the list
self
.
schedulingRule
=
SRlist
.
pop
(
0
)
# take the first criterion of the list
self
.
multipleCriterionList
=
SRlist
# hold the criteria list in the property multipleCriterionList
self
.
multipleCriterionList
=
SRlist
# hold the criteria list in the property multipleCriterionList
...
@@ -102,15 +63,16 @@ class Queue(CoreObject):
...
@@ -102,15 +63,16 @@ class Queue(CoreObject):
raise
ValueError
(
"Unknown scheduling rule %s for %s"
%
raise
ValueError
(
"Unknown scheduling rule %s for %s"
%
(
scheduling_rule
,
id
))
(
scheduling_rule
,
id
))
self
.
gatherWipStat
=
bool
(
int
(
inputsDict
.
get
(
'gatherWipStat'
,
0
)))
self
.
gatherWipStat
=
gatherWipStat
# Will be populated by an event generator
# Will be populated by an event generator
self
.
wip_stat_list
=
[]
self
.
wip_stat_list
=
[]
level
=
int
(
inputsDict
.
get
(
'level'
)
or
1
)
# trigger level for the reallocation of operators
# trigger level for the reallocation of operators
if
level
:
if
level
:
assert
level
<=
self
.
capacity
,
"the level cannot be bigger than the capacity of the queue"
assert
level
<=
self
.
capacity
,
"the level cannot be bigger than the capacity of the queue"
self
.
level
=
level
self
.
level
=
level
from
Globals
import
G
G
.
QueueList
.
append
(
self
)
@
staticmethod
@
staticmethod
def
getSupportedSchedulingRules
():
def
getSupportedSchedulingRules
():
return
(
"FIFO"
,
"Priority"
,
"EDD"
,
"EOD"
,
return
(
"FIFO"
,
"Priority"
,
"EDD"
,
"EOD"
,
...
...
dream/simulation/Source.py
View file @
8f437377
...
@@ -97,7 +97,9 @@ class Source(CoreObject):
...
@@ -97,7 +97,9 @@ class Source(CoreObject):
self
.
item
=
Globals
.
getClassFromName
(
entity
)
#the type of object that the Source will generate
self
.
item
=
Globals
.
getClassFromName
(
entity
)
#the type of object that the Source will generate
self
.
scheduledEntities
=
[]
# list of creations that are scheduled. pattern is [timeOfCreation, EntityCounter]
self
.
scheduledEntities
=
[]
# list of creations that are scheduled. pattern is [timeOfCreation, EntityCounter]
from
Globals
import
G
G
.
SourceList
.
append
(
self
)
#===========================================================================
#===========================================================================
# The initialize method of the Source class
# The initialize method of the Source class
...
...
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