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
1db697bb
Commit
1db697bb
authored
Sep 04, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Nov 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getProcessing/load/setupTime simplified - one method instead getOparationTime
parent
85060ebb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
66 deletions
+24
-66
dream/simulation/Machine.py
dream/simulation/Machine.py
+12
-34
dream/simulation/MachineJobShop.py
dream/simulation/MachineJobShop.py
+12
-32
No files found.
dream/simulation/Machine.py
View file @
1db697bb
...
@@ -59,11 +59,11 @@ class Machine(CoreObject):
...
@@ -59,11 +59,11 @@ class Machine(CoreObject):
CoreObject
.
__init__
(
self
,
id
,
name
)
CoreObject
.
__init__
(
self
,
id
,
name
)
from
Globals
import
G
from
Globals
import
G
processingTime
=
self
.
get
ProcessingTime
(
processingT
ime
=
processingTime
)
processingTime
=
self
.
get
OperationTime
(
t
ime
=
processingTime
)
setupTime
=
self
.
get
SetupTime
(
setupT
ime
=
setupTime
)
setupTime
=
self
.
get
OperationTime
(
t
ime
=
setupTime
)
loadTime
=
self
.
get
LoadTime
(
loadT
ime
=
loadTime
)
loadTime
=
self
.
get
OperationTime
(
t
ime
=
loadTime
)
# holds the capacity of the machine
# holds the capacity of the machine
self
.
capacity
=
capacity
self
.
capacity
=
capacity
...
@@ -191,37 +191,15 @@ class Machine(CoreObject):
...
@@ -191,37 +191,15 @@ class Machine(CoreObject):
self
.
processOperatorUnavailable
=
self
.
env
.
event
()
self
.
processOperatorUnavailable
=
self
.
env
.
event
()
@
staticmethod
@
staticmethod
def
getProcessingTime
(
processingTime
):
def
getOperationTime
(
time
):
'''returns the processingTime dictionary updated'''
'''returns the dictionary updated'''
if
not
processingTime
:
if
not
time
:
processingTime
=
{
'distributionType'
:
'Fixed'
,
time
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0
,
}
'mean'
:
0
}
if
processingTime
[
'distributionType'
]
==
'Normal'
and
\
if
time
[
'distributionType'
]
==
'Normal'
and
\
processingTime
.
get
(
'max'
,
None
)
is
None
:
time
.
get
(
'max'
,
None
)
is
None
:
processingTime
[
'max'
]
=
float
(
processingTime
[
'mean'
])
+
5
*
float
(
processingTime
[
'stdev'
])
time
[
'max'
]
=
float
(
time
[
'mean'
])
+
5
*
float
(
time
[
'stdev'
])
return
processingTime
return
time
@
staticmethod
def
getSetupTime
(
setupTime
):
'''returns the setupTime dictionary updated'''
if
not
setupTime
:
setupTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0
,
}
if
setupTime
[
'distributionType'
]
==
'Normal'
and
\
setupTime
.
get
(
'max'
,
None
)
is
None
:
setupTime
[
'max'
]
=
float
(
setupTime
[
'mean'
])
+
5
*
float
(
setupTime
[
'stdev'
])
return
setupTime
@
staticmethod
def
getLoadTime
(
loadTime
):
'''returns the loadTime dictionary updated'''
if
not
loadTime
:
loadTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0
,
}
if
loadTime
[
'distributionType'
]
==
'Normal'
and
\
loadTime
.
get
(
'max'
,
None
)
is
None
:
loadTime
[
'max'
]
=
float
(
loadTime
[
'mean'
])
+
5
*
float
(
loadTime
[
'stdev'
])
return
loadTime
#===========================================================================
#===========================================================================
# create an operatorPool if needed
# create an operatorPool if needed
...
...
dream/simulation/MachineJobShop.py
View file @
1db697bb
...
@@ -33,35 +33,15 @@ from RandomNumberGenerator import RandomNumberGenerator
...
@@ -33,35 +33,15 @@ from RandomNumberGenerator import RandomNumberGenerator
# ===========================================================================
# ===========================================================================
class
MachineJobShop
(
Machine
):
class
MachineJobShop
(
Machine
):
@
staticmethod
@
staticmethod
def
get
ProcessingTime
(
processingT
ime
):
def
get
OperationTime
(
t
ime
):
'''returns the processingTime dictionary updated'''
'''returns the processingTime dictionary updated'''
if
not
processingT
ime
:
if
not
t
ime
:
processingT
ime
=
{
'distributionType'
:
'Fixed'
,
t
ime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0
,
}
'mean'
:
0
,
}
if
processingTime
[
'distributionType'
]
==
'Normal'
and
\
if
time
[
'distributionType'
]
==
'Normal'
and
\
processingTime
.
get
(
'max'
,
None
)
is
None
:
time
.
get
(
'max'
,
None
)
is
None
:
processingTime
[
'max'
]
=
float
(
processingTime
[
'mean'
])
+
5
*
float
(
processingTime
[
'stdev'
])
time
[
'max'
]
=
float
(
time
[
'mean'
])
+
5
*
float
(
time
[
'stdev'
])
return
processingTime
return
time
@
staticmethod
def
getSetupTime
(
setupTime
):
'''returns the setupTime dictionary updated'''
if
not
setupTime
:
setupTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0
,
}
if
setupTime
[
'distributionType'
]
==
'Normal'
and
\
setupTime
.
get
(
'max'
,
None
)
is
None
:
setupTime
[
'max'
]
=
float
(
setupTime
[
'mean'
])
+
5
*
float
(
setupTime
[
'stdev'
])
return
setupTime
@
staticmethod
def
getLoadTime
(
loadTime
):
'''returns the loadTime dictionary updated'''
if
not
loadTime
:
loadTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0
,
}
if
loadTime
[
'distributionType'
]
==
'Normal'
and
\
loadTime
.
get
(
'max'
,
None
)
is
None
:
loadTime
[
'max'
]
=
float
(
loadTime
[
'mean'
])
+
5
*
float
(
loadTime
[
'stdev'
])
return
loadTime
# =======================================================================
# =======================================================================
# set all the objects in previous and next
# set all the objects in previous and next
...
@@ -145,12 +125,12 @@ class MachineJobShop(Machine):
...
@@ -145,12 +125,12 @@ class MachineJobShop(Machine):
# read the processing/setup/load times from the corresponding remainingRoute entry
# read the processing/setup/load times from the corresponding remainingRoute entry
processingTime
=
activeEntity
.
remainingRoute
[
0
].
get
(
'processingTime'
,{})
processingTime
=
activeEntity
.
remainingRoute
[
0
].
get
(
'processingTime'
,{})
processingTime
=
self
.
get
Processing
Time
(
processingTime
)
processingTime
=
self
.
get
Operation
Time
(
processingTime
)
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
self
.
procTime
=
self
.
rng
.
generateNumber
()
self
.
procTime
=
self
.
rng
.
generateNumber
()
setupTime
=
activeEntity
.
remainingRoute
[
0
].
get
(
'setupTime'
,{})
setupTime
=
activeEntity
.
remainingRoute
[
0
].
get
(
'setupTime'
,{})
setupTime
=
self
.
get
Setup
Time
(
setupTime
)
setupTime
=
self
.
get
Operation
Time
(
setupTime
)
self
.
stpRng
=
RandomNumberGenerator
(
self
,
**
setupTime
)
self
.
stpRng
=
RandomNumberGenerator
(
self
,
**
setupTime
)
removedStep
=
activeEntity
.
remainingRoute
.
pop
(
0
)
#remove data from the remaining route of the entity
removedStep
=
activeEntity
.
remainingRoute
.
pop
(
0
)
#remove data from the remaining route of the entity
...
@@ -189,12 +169,12 @@ class MachineJobShop(Machine):
...
@@ -189,12 +169,12 @@ class MachineJobShop(Machine):
# read the processing/setup/load times from the first entry of the full route
# read the processing/setup/load times from the first entry of the full route
activeEntity
=
self
.
getActiveObjectQueue
()[
0
]
activeEntity
=
self
.
getActiveObjectQueue
()[
0
]
processingTime
=
activeEntity
.
route
[
0
].
get
(
'processingTime'
,{})
processingTime
=
activeEntity
.
route
[
0
].
get
(
'processingTime'
,{})
processingTime
=
self
.
get
Processing
Time
(
processingTime
)
processingTime
=
self
.
get
Operation
Time
(
processingTime
)
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
self
.
rng
=
RandomNumberGenerator
(
self
,
**
processingTime
)
self
.
procTime
=
self
.
rng
.
generateNumber
()
self
.
procTime
=
self
.
rng
.
generateNumber
()
setupTime
=
activeEntity
.
route
[
0
].
get
(
'setupTime'
,{})
setupTime
=
activeEntity
.
route
[
0
].
get
(
'setupTime'
,{})
setupTime
=
self
.
get
Setup
Time
(
setupTime
)
setupTime
=
self
.
get
Operation
Time
(
setupTime
)
self
.
stpRng
=
RandomNumberGenerator
(
self
,
**
setupTime
)
self
.
stpRng
=
RandomNumberGenerator
(
self
,
**
setupTime
)
return
self
.
procTime
#this is the processing time for this unique entity
return
self
.
procTime
#this is the processing time for this unique entity
...
@@ -320,7 +300,7 @@ class MachineJobShop(Machine):
...
@@ -320,7 +300,7 @@ class MachineJobShop(Machine):
thecaller
.
sortEntities
()
thecaller
.
sortEntities
()
activeEntity
=
thecaller
.
Res
.
users
[
0
]
activeEntity
=
thecaller
.
Res
.
users
[
0
]
loadTime
=
activeEntity
.
remainingRoute
[
0
].
get
(
'loadTime'
,{})
loadTime
=
activeEntity
.
remainingRoute
[
0
].
get
(
'loadTime'
,{})
loadTime
=
self
.
get
Load
Time
(
loadTime
)
loadTime
=
self
.
get
Operation
Time
(
loadTime
)
self
.
loadRng
=
RandomNumberGenerator
(
self
,
**
loadTime
)
self
.
loadRng
=
RandomNumberGenerator
(
self
,
**
loadTime
)
# =======================================================================
# =======================================================================
...
...
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