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
1d4a885f
Commit
1d4a885f
authored
Aug 21, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Queue objects updated
parent
d8abad93
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
86 deletions
+96
-86
dream/simulation/ExitJobShop.py
dream/simulation/ExitJobShop.py
+9
-0
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+3
-68
dream/simulation/Queue.py
dream/simulation/Queue.py
+52
-15
dream/simulation/QueueJobShop.py
dream/simulation/QueueJobShop.py
+9
-0
dream/simulation/QueueManagedJob.py
dream/simulation/QueueManagedJob.py
+14
-3
dream/simulation/RoutingQueue.py
dream/simulation/RoutingQueue.py
+9
-0
No files found.
dream/simulation/ExitJobShop.py
View file @
1d4a885f
...
@@ -34,6 +34,15 @@ from Exit import Exit
...
@@ -34,6 +34,15 @@ from Exit import Exit
# the ExitJobShop object
# the ExitJobShop object
# ===========================================================================
# ===========================================================================
class
ExitJobShop
(
Exit
):
class
ExitJobShop
(
Exit
):
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
Exit
.
parseInputs
(
self
,
inputsDict
)
from
Globals
import
G
G
.
ExitJobShopList
.
append
(
self
)
# =======================================================================
# =======================================================================
# set all the objects in previous
# set all the objects in previous
# =======================================================================
# =======================================================================
...
...
dream/simulation/LineGenerationJSON.py
View file @
1d4a885f
...
@@ -292,77 +292,12 @@ def createObjects():
...
@@ -292,77 +292,12 @@ def createObjects():
G
.
ObjList
.
append
(
S
)
G
.
ObjList
.
append
(
S
)
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.MachineManagedJob'
,
'Dream.MouldAssembly'
,
'Dream.Exit'
,
'Dream.ExitJobShop'
,
'Dream.Queue'
,
'Dream.RoutingQueue'
,
'Dream.QueueJobShop'
,
'Dream.QueueManagedJob'
]:
objectType
=
Globals
.
getClassFromName
(
objClass
)
objectType
=
Globals
.
getClassFromName
(
objClass
)
coreObject
=
objectType
(
inputsDict
=
element
)
coreObject
=
objectType
(
inputsDict
=
element
)
coreObject
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
# update the nextIDs list of the machine
coreObject
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
# update the nextIDs list of the machine
elif
objClass
==
'Dream.Exit'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
E
=
Exit
(
id
,
name
)
G
.
ExitList
.
append
(
E
)
G
.
ObjList
.
append
(
E
)
elif
objClass
==
'Dream.ExitJobShop'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
E
=
ExitJobShop
(
id
,
name
)
G
.
ExitJobShopList
.
append
(
E
)
G
.
ExitList
.
append
(
E
)
G
.
ObjList
.
append
(
E
)
elif
objClass
==
'Dream.Queue'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
capacity
=
int
(
element
.
get
(
'capacity'
)
or
1
)
isDummy
=
bool
(
int
(
element
.
get
(
'isDummy'
)
or
0
))
schedulingRule
=
element
.
get
(
'schedulingRule'
,
'FIFO'
)
gatherWipStat
=
bool
(
int
(
element
.
get
(
'gatherWipStat'
,
0
)))
Q
=
Queue
(
id
,
name
,
capacity
,
isDummy
,
schedulingRule
=
schedulingRule
,
gatherWipStat
=
gatherWipStat
)
Q
.
nextIds
=
getSuccessorList
(
id
)
G
.
QueueList
.
append
(
Q
)
G
.
ObjList
.
append
(
Q
)
elif
objClass
==
'Dream.RoutingQueue'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
capacity
=
int
(
element
.
get
(
'capacity'
)
or
1
)
isDummy
=
bool
(
int
(
element
.
get
(
'isDummy'
)
or
0
))
schedulingRule
=
element
.
get
(
'schedulingRule'
,
'FIFO'
)
gatherWipStat
=
bool
(
int
(
element
.
get
(
'gatherWipStat'
,
0
)))
level
=
int
(
element
.
get
(
'level'
)
or
1
)
Q
=
RoutingQueue
(
id
,
name
,
capacity
,
isDummy
,
schedulingRule
=
schedulingRule
,
gatherWipStat
=
gatherWipStat
,
level
=
level
)
Q
.
nextIds
=
getSuccessorList
(
id
)
G
.
QueueList
.
append
(
Q
)
G
.
RoutingQueueList
.
append
(
Q
)
G
.
ObjList
.
append
(
Q
)
elif
objClass
==
'Dream.QueueJobShop'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
capacity
=
int
(
element
.
get
(
'capacity'
)
or
1
)
isDummy
=
bool
(
int
(
element
.
get
(
'isDummy'
)
or
0
))
schedulingRule
=
element
.
get
(
'schedulingRule'
,
'FIFO'
)
Q
=
QueueJobShop
(
id
,
name
,
capacity
,
isDummy
,
schedulingRule
=
schedulingRule
)
Q
.
nextIds
=
getSuccessorList
(
id
)
G
.
QueueList
.
append
(
Q
)
G
.
QueueJobShopList
.
append
(
Q
)
G
.
ObjList
.
append
(
Q
)
elif
objClass
==
'Dream.QueueManagedJob'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
capacity
=
int
(
element
.
get
(
'capacity'
)
or
1
)
isDummy
=
bool
(
int
(
element
.
get
(
'isDummy'
)
or
0
))
schedulingRule
=
element
.
get
(
'schedulingRule'
,
'FIFO'
)
Q
=
QueueManagedJob
(
id
,
name
,
capacity
,
isDummy
,
schedulingRule
=
schedulingRule
)
Q
.
nextIds
=
getSuccessorList
(
id
)
G
.
QueueList
.
append
(
Q
)
G
.
QueueManagedJobList
.
append
(
Q
)
G
.
QueueJobShopList
.
append
(
Q
)
G
.
ObjList
.
append
(
Q
)
elif
objClass
==
'Dream.QueueLIFO'
:
elif
objClass
==
'Dream.QueueLIFO'
:
id
=
element
.
get
(
'id'
,
'not found'
)
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
...
...
dream/simulation/Queue.py
View file @
1d4a885f
...
@@ -37,27 +37,63 @@ class Queue(CoreObject):
...
@@ -37,27 +37,63 @@ class Queue(CoreObject):
#===========================================================================
#===========================================================================
# the __init__ method of the Queue
# the __init__ method of the Queue
#===========================================================================
#===========================================================================
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
isDummy
=
False
,
schedulingRule
=
"FIFO"
,
level
=
None
,
gatherWipStat
=
False
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
capacity
=
1
,
isDummy
=
False
,
schedulingRule
=
"FIFO"
,
level
=
None
,
gatherWipStat
=
False
,
inputsDict
=
{}):
CoreObject
.
__init__
(
self
,
id
,
name
)
# Process.__init__(self)
# used for the routing of the entities
self
.
predecessorIndex
=
0
# holds the index of the predecessor from which the Queue will take an entity next
self
.
successorIndex
=
0
# holds the index of the successor where the Queue will dispose an entity next
self
.
type
=
"Queue"
# String that shows the type of object
self
.
type
=
"Queue"
# String that shows the type of object
# holds the capacity of the Queue
if
inputsDict
:
CoreObject
.
__init__
(
self
,
inputsDict
=
inputsDict
)
else
:
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"
)
# No failures are considered for the Queue
self
.
isDummy
=
bool
(
int
(
inputsDict
.
get
(
'isDummy'
)
or
0
))
#Boolean that shows if it is the dummy first Queue
self
.
schedulingRule
=
inputsDict
.
get
(
'schedulingRule'
,
'FIFO'
)
#the scheduling rule that the Queue follows
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
self
.
multipleCriterionList
=
[]
#list with the criteria used to sort the Entities in the Queue
SRlist
=
[
schedulingRule
]
SRlist
=
[
s
elf
.
s
chedulingRule
]
if
schedulingRule
.
startswith
(
"MC"
):
# if the first criterion is MC aka multiple criteria
if
s
elf
.
s
chedulingRule
.
startswith
(
"MC"
):
# if the first criterion is MC aka multiple criteria
SRlist
=
schedulingRule
.
split
(
"-"
)
# split the string of the criteria (delimiter -)
SRlist
=
s
elf
.
s
chedulingRule
.
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
...
@@ -66,9 +102,10 @@ class Queue(CoreObject):
...
@@ -66,9 +102,10 @@ 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
=
gatherWipStat
self
.
gatherWipStat
=
bool
(
int
(
inputsDict
.
get
(
'gatherWipStat'
,
0
)))
# 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"
...
...
dream/simulation/QueueJobShop.py
View file @
1d4a885f
...
@@ -32,6 +32,15 @@ from Queue import Queue
...
@@ -32,6 +32,15 @@ from Queue import Queue
# the QueueJobShop object
# the QueueJobShop object
# ===========================================================================
# ===========================================================================
class
QueueJobShop
(
Queue
):
class
QueueJobShop
(
Queue
):
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
Queue
.
parseInputs
(
self
,
inputsDict
)
from
Globals
import
G
G
.
QueueJobShopList
.
append
(
self
)
# =======================================================================
# =======================================================================
# set all the objects in previous and next
# set all the objects in previous and next
# =======================================================================
# =======================================================================
...
...
dream/simulation/QueueManagedJob.py
View file @
1d4a885f
...
@@ -41,12 +41,23 @@ class NoCallerError(Exception):
...
@@ -41,12 +41,23 @@ class NoCallerError(Exception):
# ===========================================================================
# ===========================================================================
class
QueueManagedJob
(
QueueJobShop
):
class
QueueManagedJob
(
QueueJobShop
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
isDummy
=
False
,
schedulingRule
=
"FIFO"
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
capacity
=
1
,
isDummy
=
False
,
schedulingRule
=
"FIFO"
,
inputsDict
=
{}):
QueueJobShop
.
__init__
(
self
,
id
=
id
,
name
=
name
,
capacity
=
capacity
,
isDummy
=
isDummy
,
schedulingRule
=
schedulingRule
)
if
inputsDict
:
QueueJobShop
.
__init__
(
self
,
inputsDict
=
inputsDict
)
else
:
QueueJobShop
.
__init__
(
self
,
id
=
id
,
name
=
name
,
capacity
=
capacity
,
isDummy
=
isDummy
,
schedulingRule
=
schedulingRule
)
# variable used by the sortEntities method
# variable used by the sortEntities method
#
to identify the object it will be sorting for (manager.checkIfResourceIsAvailable(self.objectSortingFor))
# to identify the object it will be sorting for (manager.checkIfResourceIsAvailable(self.objectSortingFor))
self
.
objectSortingFor
=
None
self
.
objectSortingFor
=
None
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
QueueJobShop
.
parseInputs
(
self
,
inputsDict
)
from
Globals
import
G
G
.
QueueManagedJobList
.
append
(
self
)
# =======================================================================
# =======================================================================
# set all the objects in previous and next
# set all the objects in previous and next
# =======================================================================
# =======================================================================
...
...
dream/simulation/RoutingQueue.py
View file @
1d4a885f
...
@@ -33,6 +33,15 @@ from Queue import Queue
...
@@ -33,6 +33,15 @@ from Queue import Queue
# the Queue object
# the Queue object
# ===========================================================================
# ===========================================================================
class
RoutingQueue
(
Queue
):
class
RoutingQueue
(
Queue
):
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
Queue
.
parseInputs
(
self
,
inputsDict
)
from
Globals
import
G
G
.
RoutingQueueList
.
append
(
self
)
# =======================================================================
# =======================================================================
# checks if the Queue can dispose an entity to the following object
# checks if the Queue can dispose an entity to the following object
# it checks also who called it and returns TRUE
# it checks also who called it and returns TRUE
...
...
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