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
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
...
@@ -49,145 +49,49 @@ class Machine(CoreObject):
...
@@ -49,145 +49,49 @@ class Machine(CoreObject):
# =======================================================================
# =======================================================================
# initialise the id the capacity, of the resource and the distribution
# initialise the id the capacity, of the resource and the distribution
# =======================================================================
# =======================================================================
def
__init__
(
self
,
id
=
''
,
name
=
''
,
capacity
=
1
,
processingTime
=
None
,
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
processingTime
=
None
,
failureDistribution
=
'No'
,
MTTF
=
0
,
MTTR
=
0
,
availability
=
0
,
repairman
=
'None'
,
\
repairman
=
'None'
,
\
operatorPool
=
'None'
,
operationType
=
'None'
,
\
operatorPool
=
'None'
,
operationType
=
'None'
,
\
setupTime
=
None
,
loadTime
=
None
,
setupTime
=
None
,
loadTime
=
None
,
isPreemptive
=
False
,
resetOnPreemption
=
False
,
isPreemptive
=
False
,
resetOnPreemption
=
False
,
canDeliverOnInterruption
=
False
,
inputsDict
=
{},
failures
=
None
):
canDeliverOnInterruption
=
False
,
inputsDict
=
{},
failures
=
None
):
self
.
type
=
"Machine"
#String that shows the type of object
self
.
type
=
"Machine"
#String that shows the type of object
# if input is given in a dictionary
CoreObject
.
__init__
(
self
,
id
,
name
)
if
inputsDict
:
CoreObject
.
__init__
(
self
,
inputsDict
=
inputsDict
)
# else read the separate ones
else
:
CoreObject
.
__init__
(
self
,
id
,
name
)
if
not
processingTime
:
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
1
,
}
if
processingTime
[
'distributionType'
]
==
'Normal'
and
\
processingTime
.
get
(
'max'
,
None
)
is
None
:
processingTime
[
'max'
]
=
float
(
processingTime
[
'mean'
])
+
5
*
float
(
processingTime
[
'stdev'
])
if
not
setupTime
:
setupTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
1
,
}
if
setupTime
[
'distributionType'
]
==
'Normal'
and
\
setupTime
.
get
(
'max'
,
None
)
is
None
:
setupTime
[
'max'
]
=
float
(
setupTime
[
'mean'
])
+
5
*
float
(
setupTime
[
'stdev'
])
if
not
loadTime
:
loadTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
1
,
}
if
loadTime
[
'distributionType'
]
==
'Normal'
and
\
loadTime
.
get
(
'max'
,
None
)
is
None
:
loadTime
[
'max'
]
=
float
(
loadTime
[
'mean'
])
+
5
*
float
(
loadTime
[
'stdev'
])
# holds the capacity of the machine
self
.
capacity
=
capacity
# define the distribution types of the processing and failure times respectively
self
.
failureDistType
=
failureDistribution
#the distribution that the failure follows
# sets the repairman resource of the Machine
self
.
repairman
=
repairman
# Sets the attributes of the processing (and failure) time(s)
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
self
.
MTTF
=
MTTF
self
.
MTTR
=
MTTR
self
.
availability
=
availability
# check whether the operators are provided with a skills set
self
.
dedicatedOperator
=
self
.
checkForDedicatedOperators
()
# create an operatorPool if needed
self
.
createOperatorPool
(
operatorPool
)
# holds the Operator currently processing the Machine
self
.
currentOperator
=
None
# define if load/setup/removal/processing are performed by the operator
self
.
operationType
=
operationType
# boolean to check whether the machine is being operated
self
.
toBeOperated
=
False
# define the load times
self
.
loadRng
=
RandomNumberGenerator
(
self
,
**
loadTime
)
# variable that informs on the need for setup
self
.
setUp
=
True
# define the setup times
self
.
stpRng
=
RandomNumberGenerator
(
self
,
**
setupTime
)
# examine if there are multiple operation types performed by the operator
# there can be Setup/Processing operationType
# or the combination of both (MT-Load-Setup-Processing)
self
.
multOperationTypeList
=
[]
if
self
.
operationType
.
startswith
(
"MT"
):
OTlist
=
operationType
.
split
(
'-'
)
self
.
operationType
=
OTlist
.
pop
(
0
)
self
.
multOperationTypeList
=
OTlist
else
:
self
.
multOperationTypeList
.
append
(
self
.
operationType
)
# flags used for preemption purposes
self
.
isPreemptive
=
isPreemptive
self
.
resetOnPreemption
=
resetOnPreemption
# flag notifying that there is operator assigned to the actievObject
self
.
assignedOperator
=
True
# flag notifying the the station can deliver entities that ended their processing while interrupted
self
.
canDeliverOnInterruption
=
canDeliverOnInterruption
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
CoreObject
.
parseInputs
(
self
,
inputsDict
)
from
Globals
import
G
processingTime
=
inputsDict
.
get
(
'processingTime'
,{})
if
not
processingTime
:
if
not
processingTime
:
processingTime
=
{
'distributionType'
:
'Fixed'
,
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
1
,
}
'mean'
:
1
,
}
if
processingTime
[
'distributionType'
]
==
'Normal'
and
\
if
processingTime
[
'distributionType'
]
==
'Normal'
and
\
processingTime
.
get
(
'max'
,
None
)
is
None
:
processingTime
.
get
(
'max'
,
None
)
is
None
:
processingTime
[
'max'
]
=
float
(
processingTime
[
'mean'
])
+
5
*
float
(
processingTime
[
'stdev'
])
processingTime
[
'max'
]
=
float
(
processingTime
[
'mean'
])
+
5
*
float
(
processingTime
[
'stdev'
])
setupTime
=
inputsDict
.
get
(
'setupTime'
,{})
if
not
setupTime
:
if
not
setupTime
:
setupTime
=
{
'distributionType'
:
'Fixed'
,
setupTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
1
,
}
'mean'
:
1
,
}
if
setupTime
[
'distributionType'
]
==
'Normal'
and
\
if
setupTime
[
'distributionType'
]
==
'Normal'
and
\
setupTime
.
get
(
'max'
,
None
)
is
None
:
setupTime
.
get
(
'max'
,
None
)
is
None
:
setupTime
[
'max'
]
=
float
(
setupTime
[
'mean'
])
+
5
*
float
(
setupTime
[
'stdev'
])
setupTime
[
'max'
]
=
float
(
setupTime
[
'mean'
])
+
5
*
float
(
setupTime
[
'stdev'
])
loadTime
=
inputsDict
.
get
(
'loadTime'
,{})
if
not
loadTime
:
if
not
loadTime
:
loadTime
=
{
'distributionType'
:
'Fixed'
,
loadTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
1
,
}
'mean'
:
1
,
}
if
loadTime
[
'distributionType'
]
==
'Normal'
and
\
if
loadTime
[
'distributionType'
]
==
'Normal'
and
\
loadTime
.
get
(
'max'
,
None
)
is
None
:
loadTime
.
get
(
'max'
,
None
)
is
None
:
loadTime
[
'max'
]
=
float
(
loadTime
[
'mean'
])
+
5
*
float
(
loadTime
[
'stdev'
])
loadTime
[
'max'
]
=
float
(
loadTime
[
'mean'
])
+
5
*
float
(
loadTime
[
'stdev'
])
# holds the capacity of the machine
# holds the capacity of the machine
self
.
capacity
=
inputsDict
.
get
(
'capacity'
,
1
)
self
.
capacity
=
capacity
# define the distribution types of the processing and failure times respectively
# sets the repairman resource of the Machine
self
.
repairman
=
repairman
# Sets the attributes of the processing (and failure) time(s)
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
# check whether the operators are provided with a skills set
# check whether the operators are provided with a skills set
self
.
dedicatedOperator
=
self
.
checkForDedicatedOperators
()
self
.
dedicatedOperator
=
self
.
checkForDedicatedOperators
()
if
len
(
G
.
OperatorPoolsList
)
>
0
:
for
operatorPool
in
G
.
OperatorPoolsList
:
# find the operatorPool assigned to the machine
if
(
self
.
id
in
operatorPool
.
coreObjectIds
):
# and add it to the machine's operatorPool
machineOperatorPoolList
=
operatorPool
# there must only one operator pool assigned to the machine,
# otherwise only one of them will be taken into account
else
:
machineOperatorPoolList
=
[]
# if there is no operatorPool assigned to the machine
else
:
# then machineOperatorPoolList/operatorPool is a list
machineOperatorPoolList
=
[]
# if there are no operatorsPool created then the
# then machineOperatorPoolList/operatorPool is a list
if
(
type
(
machineOperatorPoolList
)
is
list
):
# if the machineOperatorPoolList is a list
# find the operators assigned to it and add them to the list
for
operator
in
G
.
OperatorsList
:
# check which operator in the G.OperatorsList
if
(
self
.
id
in
operator
.
coreObjectIds
):
# (if any) is assigned to operate
machineOperatorPoolList
.
append
(
operator
)
# the machine with ID equal to id
self
.
operatorPool
=
machineOperatorPoolList
# create an operatorPool if needed
# create an operatorPool if needed
self
.
createOperatorPool
(
self
.
operatorPool
)
self
.
createOperatorPool
(
operatorPool
)
# holds the Operator currently processing the Machine
# holds the Operator currently processing the Machine
self
.
currentOperator
=
None
self
.
currentOperator
=
None
# define if load/setup/removal/processing are performed by the operator
# define if load/setup/removal/processing are performed by the operator
self
.
operationType
=
inputsDict
.
get
(
'operationType'
,
'None'
)
self
.
operationType
=
operationType
# boolean to check whether the machine is being operated
# boolean to check whether the machine is being operated
self
.
toBeOperated
=
False
self
.
toBeOperated
=
False
# define the load times
# define the load times
...
@@ -201,32 +105,28 @@ class Machine(CoreObject):
...
@@ -201,32 +105,28 @@ class Machine(CoreObject):
# or the combination of both (MT-Load-Setup-Processing)
# or the combination of both (MT-Load-Setup-Processing)
self
.
multOperationTypeList
=
[]
self
.
multOperationTypeList
=
[]
if
self
.
operationType
.
startswith
(
"MT"
):
if
self
.
operationType
.
startswith
(
"MT"
):
OTlist
=
self
.
operationType
.
split
(
'-'
)
OTlist
=
operationType
.
split
(
'-'
)
self
.
operationType
=
OTlist
.
pop
(
0
)
self
.
operationType
=
OTlist
.
pop
(
0
)
self
.
multOperationTypeList
=
OTlist
self
.
multOperationTypeList
=
OTlist
else
:
else
:
self
.
multOperationTypeList
.
append
(
self
.
operationType
)
self
.
multOperationTypeList
.
append
(
self
.
operationType
)
# flags used for preemption purposes
# flags used for preemption purposes
preemption
=
inputsDict
.
get
(
'preemption'
,{})
self
.
isPreemptive
=
isPreemptive
self
.
isPreemptive
=
False
self
.
resetOnPreemption
=
resetOnPreemption
self
.
resetOnPreemption
=
False
if
len
(
preemption
)
>
0
:
self
.
isPreemptive
=
bool
(
int
(
preemption
.
get
(
'isPreemptive'
)
or
0
))
self
.
resetOnPreemption
=
bool
(
int
(
preemption
.
get
(
'resetOnPreemption'
,
0
)))
# flag notifying that there is operator assigned to the actievObject
# flag notifying that there is operator assigned to the actievObject
self
.
assignedOperator
=
True
self
.
assignedOperator
=
True
# flag notifying the the station can deliver entities that ended their processing while interrupted
# flag notifying the the station can deliver entities that ended their processing while interrupted
self
.
canDeliverOnInterruption
=
bool
(
inputsDict
.
get
(
'canDeliverOnInterruption'
)
or
0
)
self
.
canDeliverOnInterruption
=
canDeliverOnInterruption
from
Globals
import
G
self
.
repairman
=
'None'
self
.
repairman
=
'None'
for
repairman
in
G
.
RepairmanList
:
# check which repairman in the G.RepairmanList
for
repairman
in
G
.
RepairmanList
:
# check which repairman in the G.RepairmanList
if
(
self
.
id
in
repairman
.
coreObjectIds
):
# (if any) is assigned to repair
if
(
self
.
id
in
repairman
.
coreObjectIds
):
# (if any) is assigned to repair
self
.
repairman
=
repairman
# the machine with ID equal to id
self
.
repairman
=
repairman
# the machine with ID equal to id
G
.
MachineList
.
append
(
self
)
# add machine to global MachineList
G
.
MachineList
.
append
(
self
)
# add machine to global MachineList
if
self
.
operatorPool
!=
"None"
:
if
self
.
operatorPool
!=
"None"
:
G
.
OperatedMachineList
.
append
(
self
)
# add the machine to the operatedMachines List
G
.
OperatedMachineList
.
append
(
self
)
# add the machine to the operatedMachines List
# =======================================================================
# =======================================================================
# initialize the machine
# initialize the machine
...
...
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