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
f969ec9a
Commit
f969ec9a
authored
Aug 21, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more changes
parent
8f437377
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
56 additions
and
144 deletions
+56
-144
dream/simulation/BatchDecomposition.py
dream/simulation/BatchDecomposition.py
+4
-2
dream/simulation/BatchReassembly.py
dream/simulation/BatchReassembly.py
+2
-0
dream/simulation/BatchScrapMachine.py
dream/simulation/BatchScrapMachine.py
+12
-40
dream/simulation/BatchSource.py
dream/simulation/BatchSource.py
+3
-1
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+4
-2
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+4
-27
dream/simulation/JSONInputs/Topology14.json
dream/simulation/JSONInputs/Topology14.json
+0
-6
dream/simulation/JSONInputs/Topology32.json
dream/simulation/JSONInputs/Topology32.json
+0
-3
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+5
-61
dream/simulation/Machine.py
dream/simulation/Machine.py
+22
-2
No files found.
dream/simulation/BatchDecomposition.py
View file @
f969ec9a
...
...
@@ -57,11 +57,13 @@ class BatchDecomposition(CoreObject):
processingTime
[
'max'
]
=
float
(
processingTime
[
'mean'
])
+
5
*
float
(
processingTime
[
'stdev'
])
# holds the capacity of the object
self
.
numberOfSubBatches
=
numberOfSubBatches
self
.
numberOfSubBatches
=
int
(
numberOfSubBatches
)
# sets the operator resource of the Machine
self
.
operator
=
operator
# Sets the attributes of the processing (and failure) time(s)
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
from
Globals
import
G
G
.
BatchDecompositionList
.
append
(
self
)
# =======================================================================
# initialize the internal resource of the object
...
...
@@ -99,7 +101,7 @@ class BatchDecomposition(CoreObject):
self
.
isProcessingInitialWIP
=
True
break
# otherwise proceed with getEntity
else
:
else
:
requestingObject
=
self
.
isRequested
.
value
assert
requestingObject
==
self
.
giver
,
'the giver is not the requestingObject'
self
.
isRequested
=
self
.
env
.
event
()
...
...
dream/simulation/BatchReassembly.py
View file @
f969ec9a
...
...
@@ -60,6 +60,8 @@ class BatchReassembly(CoreObject):
self
.
operator
=
operator
# Sets the attributes of the processing (and failure) time(s)
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
from
Globals
import
G
G
.
BatchReassemblyList
.
append
(
self
)
# =======================================================================
# initialize the internal resource of the object
...
...
dream/simulation/BatchScrapMachine.py
View file @
f969ec9a
...
...
@@ -43,48 +43,20 @@ class BatchScrapMachine(Machine):
# calls the Machine constructor, but also reads attributes for
# scraping distribution
# =======================================================================
def
__init__
(
self
,
id
=
''
,
name
=
''
,
capacity
=
1
,
\
processingTime
=
None
,
failureDistribution
=
'No'
,
MTTF
=
0
,
MTTR
=
0
,
availability
=
0
,
repairman
=
'None'
,
\
scrapDistribution
=
'Fixed'
,
scrMean
=
1
,
scrStdev
=
0
,
scrMin
=
0
,
scrMax
=
10
,
inputsDict
=
{}):
# if input is given in a dictionary
if
inputsDict
:
Machine
.
__init__
(
self
,
inputsDict
=
inputsDict
)
# else read the separate ones
else
:
if
not
processingTime
:
processingTime
=
{
'distribution'
:
'Fixed'
,
'mean'
:
1
}
# initialize using the default method of the object
Machine
.
__init__
(
self
,
id
=
id
,
name
=
name
,
\
capacity
=
capacity
,
\
processingTime
=
processingTime
,
failureDistribution
=
failureDistribution
,
MTTF
=
MTTF
,
MTTR
=
MTTR
,
\
availability
=
availability
,
repairman
=
repairman
)
self
.
scrapDistType
=
scrapDistribution
#the distribution that the failure follows
# set the attributes of the scrap quantity distribution
self
.
scrapRng
=
RandomNumberGenerator
(
self
,
self
.
scrapDistType
)
self
.
scrapRng
.
mean
=
scrMean
self
.
scrapRng
.
stdev
=
scrStdev
self
.
scrapRng
.
min
=
scrMin
self
.
scrapRng
.
max
=
scrMax
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
\
processingTime
=
None
,
repairman
=
'None'
,
\
scrapQuantity
=
{}):
if
not
processingTime
:
processingTime
=
{
'distribution'
:
'Fixed'
,
'mean'
:
1
}
# initialize using the default method of the object
Machine
.
__init__
(
self
,
id
=
id
,
name
=
name
,
\
capacity
=
capacity
,
\
processingTime
=
processingTime
,
repairman
=
repairman
)
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
Machine
.
parseInputs
(
self
,
inputsDict
)
# set the attributes of the scrap quantity distribution
scrapQuantity
=
inputsDict
.
get
(
'scrapQuantity'
,
{})
self
.
scrapDistType
=
scrapQuantity
.
get
(
'distributionType'
,
'Fixed'
)
self
.
scrapRng
=
RandomNumberGenerator
(
self
,
self
.
scrapDistType
)
self
.
scrapRng
.
mean
=
float
(
scrapQuantity
.
get
(
'mean'
)
or
0
)
self
.
scrapRng
.
stdev
=
float
(
scrapQuantity
.
get
(
'stdev'
)
or
0
)
self
.
scrapRng
.
min
=
float
(
scrapQuantity
.
get
(
'min'
)
or
0
)
self
.
scrapRng
.
max
=
float
(
scrapQuantity
.
get
(
'max'
)
or
self
.
scrapRng
.
mean
+
5
*
self
.
scrapRng
.
stdev
)
self
.
scrapRng
=
RandomNumberGenerator
(
self
,
**
scrapQuantity
)
from
Globals
import
G
G
.
BatchScrapMachineList
.
append
(
self
)
...
...
dream/simulation/BatchSource.py
View file @
f969ec9a
...
...
@@ -35,7 +35,9 @@ class BatchSource(Source):
entity
=
'Dream.Batch'
,
batchNumberOfUnits
=
1
):
Source
.
__init__
(
self
,
id
=
id
,
name
=
name
,
interarrivalTime
=
interarrivalTime
,
entity
=
entity
)
self
.
numberOfUnits
=
batchNumberOfUnits
self
.
numberOfUnits
=
int
(
batchNumberOfUnits
)
from
Globals
import
G
G
.
BatchSourceList
.
append
(
self
)
def
createEntity
(
self
):
...
...
dream/simulation/Conveyer.py
View file @
f969ec9a
...
...
@@ -43,8 +43,8 @@ class Conveyer(CoreObject):
def
__init__
(
self
,
id
,
name
,
length
,
speed
):
CoreObject
.
__init__
(
self
,
id
,
name
)
self
.
type
=
"Conveyer"
self
.
speed
=
speed
#the speed of the conveyer in m/sec
self
.
length
=
length
#the length of the conveyer in meters
self
.
speed
=
float
(
speed
)
#the speed of the conveyer in m/sec
self
.
length
=
float
(
length
)
#the length of the conveyer in meters
# counting the total number of units to be moved through the whole simulation time
self
.
numberOfMoves
=
0
...
...
@@ -55,6 +55,8 @@ class Conveyer(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
from
Globals
import
G
G
.
ConveyerList
.
append
(
self
)
#===========================================================================
# the initialize method
...
...
dream/simulation/Dismantle.py
View file @
f969ec9a
...
...
@@ -42,7 +42,7 @@ class Dismantle(CoreObject):
#===========================================================================
# initialize the object
#===========================================================================
def
__init__
(
self
,
id
=
''
,
name
=
''
,
processingTime
=
None
,
inputsDict
=
{}
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
processingTime
=
None
):
self
.
type
=
'Dismantle'
self
.
previous
=
[]
#list with the previous objects in the flow
...
...
@@ -64,29 +64,7 @@ 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'
,{})
CoreObject
.
__init__
(
self
,
id
,
name
)
from
Globals
import
G
if
not
processingTime
:
processingTime
=
{
'distributionType'
:
'Fixed'
,
...
...
@@ -97,10 +75,9 @@ class Dismantle(CoreObject):
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
)
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
#===========================================================================
# the initialize method
#===========================================================================
...
...
dream/simulation/JSONInputs/Topology14.json
View file @
f969ec9a
...
...
@@ -80,12 +80,6 @@
"distributionType"
:
"Fixed"
,
"mean"
:
1.0
},
"successorFrameList"
:
[
"M2"
],
"successorPartList"
:
[
"M3"
],
"top"
:
0.40931372549019607
},
"E1"
:
{
...
...
dream/simulation/JSONInputs/Topology32.json
View file @
f969ec9a
...
...
@@ -85,9 +85,6 @@
"isDummy"
:
"0"
,
"left"
:
0.4414893617021277
,
"name"
:
"Q1"
,
"predecessorList"
:
[
"M1"
],
"top"
:
0.40909090909090906
},
"S1"
:
{
...
...
dream/simulation/LineGenerationJSON.py
View file @
f969ec9a
...
...
@@ -277,18 +277,13 @@ def createObjects():
for
k
in
(
'element_id'
,
'top'
,
'left'
):
element
.
pop
(
k
,
None
)
objClass
=
element
.
pop
(
'_class'
)
if
objClass
==
'Dream.BatchSource'
:
S
=
BatchSource
(
**
element
)
S
.
nextIds
=
getSuccessorList
(
element
[
'id'
])
G
.
BatchSourceList
.
append
(
S
)
G
.
SourceList
.
append
(
S
)
G
.
ObjList
.
append
(
S
)
el
if
objClass
in
[
'Dream.Machine'
,
'Dream.BatchScrapMachine'
,
'Dream.M3'
,
'Dream.MachineJobShop'
,
if
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.Assembly'
,
'Dream.Dismantle'
,
'Dream.Source'
]:
'Dream.Assembly'
,
'Dream.Dismantle'
,
'Dream.Source'
,
'Dream.Conveyer'
,
'Dream.BatchDecomposition'
,
'Dream.BatchReassembly'
,
'Dream.LineClearance'
,
'Dream.BatchSource'
]:
inputDict
=
dict
(
element
)
if
'wip'
in
inputDict
:
del
inputDict
[
'wip'
]
...
...
@@ -303,58 +298,7 @@ def createObjects():
# get the successorList for the 'Frames'
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 object
elif
objClass
==
'Dream.Conveyer'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
length
=
float
(
element
.
get
(
'length'
)
or
mean
+
5
*
stdev
)
speed
=
float
(
element
.
get
(
'speed'
)
or
1
)
C
=
Conveyer
(
id
,
name
,
length
,
speed
)
C
.
nextIds
=
getSuccessorList
(
id
)
G
.
ObjList
.
append
(
C
)
G
.
ConveyerList
.
append
(
C
)
elif
objClass
==
'Dream.BatchDecomposition'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
processingTime
=
element
.
get
(
'processingTime'
,
{})
numberOfSubBatches
=
int
(
element
.
get
(
'numberOfSubBatches'
)
or
0
)
BD
=
BatchDecomposition
(
id
,
name
,
processingTime
=
processingTime
,
numberOfSubBatches
=
numberOfSubBatches
)
BD
.
nextIds
=
getSuccessorList
(
id
)
G
.
BatchDecompositionList
.
append
(
BD
)
G
.
ObjList
.
append
(
BD
)
elif
objClass
==
'Dream.BatchDecompositionStartTime'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
processingTime
=
element
.
get
(
'processingTime'
,
{})
numberOfSubBatches
=
int
(
element
.
get
(
'numberOfSubBatches'
)
or
0
)
BD
=
BatchDecompositionStartTime
(
id
,
name
,
processingTime
=
processingTime
,
numberOfSubBatches
=
numberOfSubBatches
)
BD
.
nextIds
=
getSuccessorList
(
id
)
G
.
BatchDecompositionList
.
append
(
BD
)
G
.
ObjList
.
append
(
BD
)
elif
objClass
==
'Dream.BatchReassembly'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
processingTime
=
element
.
get
(
'processingTime'
,
{})
numberOfSubBatches
=
int
(
element
.
get
(
'numberOfSubBatches'
)
or
0
)
BR
=
BatchReassembly
(
id
,
name
,
processingTime
=
processingTime
,
numberOfSubBatches
=
numberOfSubBatches
)
BR
.
nextIds
=
getSuccessorList
(
id
)
G
.
BatchReassemblyList
.
append
(
BR
)
G
.
ObjList
.
append
(
BR
)
elif
objClass
==
'Dream.LineClearance'
:
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'
)
LC
=
LineClearance
(
id
,
name
,
capacity
,
isDummy
,
schedulingRule
=
schedulingRule
)
LC
.
nextIds
=
getSuccessorList
(
id
)
G
.
LineClearanceList
.
append
(
LC
)
G
.
ObjList
.
append
(
LC
)
elif
objClass
==
'Dream.OrderDecomposition'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
...
...
dream/simulation/Machine.py
View file @
f969ec9a
...
...
@@ -57,6 +57,7 @@ class Machine(CoreObject):
canDeliverOnInterruption
=
False
,
inputsDict
=
{},
failures
=
None
):
self
.
type
=
"Machine"
#String that shows the type of object
CoreObject
.
__init__
(
self
,
id
,
name
)
from
Globals
import
G
if
not
processingTime
:
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
1
,
}
...
...
@@ -85,9 +86,29 @@ class Machine(CoreObject):
# Sets the attributes of the processing (and failure) time(s)
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
()
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
self
.
dedicatedOperator
=
self
.
checkForDedicatedOperators
()
# create an operatorPool if needed
self
.
createOperatorPool
(
operatorPool
)
self
.
createOperatorPool
(
self
.
operatorPool
)
# holds the Operator currently processing the Machine
self
.
currentOperator
=
None
# define if load/setup/removal/processing are performed by the operator
...
...
@@ -118,7 +139,6 @@ class Machine(CoreObject):
self
.
assignedOperator
=
True
# flag notifying the the station can deliver entities that ended their processing while interrupted
self
.
canDeliverOnInterruption
=
canDeliverOnInterruption
from
Globals
import
G
self
.
repairman
=
'None'
for
repairman
in
G
.
RepairmanList
:
# check which repairman in the G.RepairmanList
if
(
self
.
id
in
repairman
.
coreObjectIds
):
# (if any) is assigned to repair
...
...
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