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
879ccb58
Commit
879ccb58
authored
Aug 21, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all CoreObjects in the new way. 2 tests fail others pass
parent
f969ec9a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
65 deletions
+56
-65
dream/simulation/BatchScrapMachine.py
dream/simulation/BatchScrapMachine.py
+5
-1
dream/simulation/CapacityStation.py
dream/simulation/CapacityStation.py
+2
-0
dream/simulation/CapacityStationBuffer.py
dream/simulation/CapacityStationBuffer.py
+3
-1
dream/simulation/CapacityStationExit.py
dream/simulation/CapacityStationExit.py
+3
-1
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+36
-58
dream/simulation/Machine.py
dream/simulation/Machine.py
+7
-4
No files found.
dream/simulation/BatchScrapMachine.py
View file @
879ccb58
...
...
@@ -47,7 +47,7 @@ class BatchScrapMachine(Machine):
processingTime
=
None
,
repairman
=
'None'
,
\
scrapQuantity
=
{}):
if
not
processingTime
:
processingTime
=
{
'distribution'
:
'Fixed'
,
processingTime
=
{
'distribution
Type
'
:
'Fixed'
,
'mean'
:
1
}
# initialize using the default method of the object
Machine
.
__init__
(
self
,
id
=
id
,
name
=
name
,
\
...
...
@@ -56,6 +56,10 @@ class BatchScrapMachine(Machine):
repairman
=
repairman
)
# set the attributes of the scrap quantity distribution
if
not
scrapQuantity
:
scrapQuantity
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0
}
self
.
scrapRng
=
RandomNumberGenerator
(
self
,
**
scrapQuantity
)
from
Globals
import
G
G
.
BatchScrapMachineList
.
append
(
self
)
...
...
dream/simulation/CapacityStation.py
View file @
879ccb58
...
...
@@ -67,6 +67,8 @@ class CapacityStation(Queue):
self
.
isLocked
=
True
self
.
utilisationDict
=
[]
# a list of dicts for the utilization results
self
.
detailedWorkPlan
=
[]
# a list of dicts to keep detailed data
from
Globals
import
G
G
.
CapacityStationList
.
append
(
self
)
def
canAccept
(
self
,
callerObject
=
None
):
if
self
.
isLocked
:
...
...
dream/simulation/CapacityStationBuffer.py
View file @
879ccb58
...
...
@@ -39,7 +39,9 @@ class CapacityStationBuffer(Queue):
Queue
.
__init__
(
self
,
id
,
name
,
capacity
=
capacity
)
self
.
isLocked
=
True
self
.
requireFullProject
=
requireFullProject
# flag that shows if here the whole project is assembled
from
Globals
import
G
G
.
CapacityStationBufferList
.
append
(
self
)
def
initialize
(
self
):
Queue
.
initialize
(
self
)
self
.
isLocked
=
True
...
...
dream/simulation/CapacityStationExit.py
View file @
879ccb58
...
...
@@ -44,7 +44,9 @@ class CapacityStationExit(Exit):
self
.
nextCapacityStationBufferId
=
nextCapacityStationBufferId
# the id of the next station. If it is None it
# means it is the end of the system.
self
.
nextCapacityStationBuffer
=
None
# the next buffer. If it is None it
# means it is the end of the system.
from
Globals
import
G
G
.
CapacityStationExitList
.
append
(
self
)
# means it is the end of the system.
def
initialize
(
self
):
Exit
.
initialize
(
self
)
self
.
isLocked
=
True
...
...
dream/simulation/LineGenerationJSON.py
View file @
879ccb58
...
...
@@ -243,8 +243,8 @@ def createObjects():
# element itself
element
=
element
.
copy
()
element
[
'id'
]
=
element_id
# create a new entry for the element (dictionary)
for
k
in
(
'element_id'
,
'top'
,
'left'
):
element
.
pop
(
k
,
None
)
#
for k in ('element_id', 'top', 'left'):
#
element.pop(k, None)
# with key 'id' and value the the element_id
resourceClass
=
element
.
pop
(
'_class'
)
# get the class type of the element
if
resourceClass
==
'Dream.OperatorPool'
:
...
...
@@ -283,7 +283,9 @@ def createObjects():
'Dream.Queue'
,
'Dream.RoutingQueue'
,
'Dream.QueueJobShop'
,
'Dream.QueueManagedJob'
,
'Dream.Assembly'
,
'Dream.Dismantle'
,
'Dream.Source'
,
'Dream.Conveyer'
,
'Dream.BatchDecomposition'
,
'Dream.BatchReassembly'
,
'Dream.LineClearance'
,
'Dream.BatchSource'
]:
'Dream.BatchSource'
,
'Dream.OrderDecomposition'
,
'Dream.MouldAssemblyBuffer'
,
'Dream.ConditionalBuffer'
,
'Dream.BatchDecompositionStartTime'
,
'Dream.ConditionalBuffer'
,
'Dream.CapacityStation'
,
'Dream.CapacityStationBuffer'
,
'Dream.CapacityStationExit'
]:
inputDict
=
dict
(
element
)
if
'wip'
in
inputDict
:
del
inputDict
[
'wip'
]
...
...
@@ -291,6 +293,8 @@ def createObjects():
del
inputDict
[
'failures'
]
if
'shift'
in
inputDict
:
del
inputDict
[
'shift'
]
if
'scheduledMaintenance'
in
inputDict
:
del
inputDict
[
'scheduledMaintenance'
]
objectType
=
Globals
.
getClassFromName
(
objClass
)
coreObject
=
objectType
(
**
inputDict
)
# get the successorList for the 'Parts'
...
...
@@ -298,61 +302,35 @@ 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.OrderDecomposition'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
OD
=
OrderDecomposition
(
id
,
name
)
G
.
OrderDecompositionList
.
append
(
OD
)
G
.
ObjList
.
append
(
OD
)
elif
objClass
==
'Dream.ConditionalBuffer'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
CB
=
ConditionalBuffer
(
id
,
name
)
CB
.
nextIds
=
getSuccessorList
(
id
)
G
.
QueueList
.
append
(
CB
)
G
.
QueueJobShopList
.
append
(
CB
)
G
.
ConditionalBufferList
.
append
(
CB
)
G
.
ObjList
.
append
(
CB
)
elif
objClass
==
'Dream.MouldAssemblyBuffer'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
MAB
=
MouldAssemblyBuffer
(
id
,
name
)
MAB
.
nextIds
=
getSuccessorList
(
id
)
G
.
QueueList
.
append
(
MAB
)
G
.
QueueJobShopList
.
append
(
MAB
)
G
.
MouldAssemblyBufferList
.
append
(
MAB
)
G
.
ObjList
.
append
(
MAB
)
elif
objClass
==
'Dream.CapacityStation'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
intervalCapacity
=
element
.
get
(
'intervalCapacity'
,
[])
sharedResources
=
element
.
get
(
'sharedResources'
,
{})
CS
=
CapacityStation
(
id
,
name
,
intervalCapacity
=
intervalCapacity
,
sharedResources
=
sharedResources
)
CS
.
nextIds
=
getSuccessorList
(
id
)
G
.
CapacityStationList
.
append
(
CS
)
G
.
ObjList
.
append
(
CS
)
elif
objClass
==
'Dream.CapacityStationBuffer'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
requireFullProject
=
bool
(
element
.
get
(
'requireFullProject'
,
0
))
CB
=
CapacityStationBuffer
(
id
,
name
,
requireFullProject
=
requireFullProject
)
CB
.
nextIds
=
getSuccessorList
(
id
)
G
.
CapacityStationBufferList
.
append
(
CB
)
G
.
ObjList
.
append
(
CB
)
elif
objClass
==
'Dream.CapacityStationExit'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
nextCapacityStationBufferId
=
element
.
get
(
'nextCapacityStationBufferId'
,
None
)
CE
=
CapacityStationExit
(
id
,
name
,
nextCapacityStationBufferId
=
nextCapacityStationBufferId
)
G
.
CapacityStationExitList
.
append
(
CE
)
G
.
ExitList
.
append
(
CE
)
G
.
ObjList
.
append
(
CE
)
# elif objClass=='Dream.CapacityStation':
# id=element.get('id', 'not found')
# name=element.get('name', 'not found')
# intervalCapacity=element.get('intervalCapacity', [])
# sharedResources=element.get('sharedResources', {})
# CS=CapacityStation(id,name,intervalCapacity=intervalCapacity, sharedResources=sharedResources)
# CS.nextIds=getSuccessorList(id)
# G.CapacityStationList.append(CS)
# G.ObjList.append(CS)
#
# elif objClass=='Dream.CapacityStationBuffer':
# id=element.get('id', 'not found')
# name=element.get('name', 'not found')
# requireFullProject=bool(element.get('requireFullProject', 0))
# CB=CapacityStationBuffer(id,name,requireFullProject=requireFullProject)
# CB.nextIds=getSuccessorList(id)
# G.CapacityStationBufferList.append(CB)
# G.ObjList.append(CB)
#
# elif objClass=='Dream.CapacityStationExit':
# id=element.get('id', 'not found')
# name=element.get('name', 'not found')
# nextCapacityStationBufferId=element.get('nextCapacityStationBufferId', None)
# CE=CapacityStationExit(id,name,nextCapacityStationBufferId=nextCapacityStationBufferId)
# G.CapacityStationExitList.append(CE)
# G.ExitList.append(CE)
# G.ObjList.append(CE)
# -----------------------------------------------------------------------
# loop through all the nodes to
...
...
dream/simulation/Machine.py
View file @
879ccb58
...
...
@@ -53,8 +53,8 @@ class Machine(CoreObject):
repairman
=
'None'
,
\
operatorPool
=
'None'
,
operationType
=
'None'
,
\
setupTime
=
None
,
loadTime
=
None
,
isPreemptive
=
False
,
resetOnPreemption
=
False
,
canDeliverOnInterruption
=
False
,
inputsDict
=
{},
failures
=
None
):
preemption
=
{}
,
canDeliverOnInterruption
=
False
):
self
.
type
=
"Machine"
#String that shows the type of object
CoreObject
.
__init__
(
self
,
id
,
name
)
from
Globals
import
G
...
...
@@ -133,8 +133,11 @@ class Machine(CoreObject):
self
.
multOperationTypeList
.
append
(
self
.
operationType
)
# flags used for preemption purposes
self
.
isPreemptive
=
isPreemptive
self
.
resetOnPreemption
=
resetOnPreemption
self
.
isPreemptive
=
False
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
self
.
assignedOperator
=
True
# flag notifying the the station can deliver entities that ended their processing while interrupted
...
...
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