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
bd7b85f5
Commit
bd7b85f5
authored
Feb 02, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin to create CapacityStationBuffer and CapacityStationExit added
parent
06b4a8e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
3 deletions
+77
-3
dream/plugins/CreateCapacityStations.py
dream/plugins/CreateCapacityStations.py
+70
-0
dream/simulation/Examples/CapacityProjectAllInOneEmpty.json
dream/simulation/Examples/CapacityProjectAllInOneEmpty.json
+7
-3
No files found.
dream/plugins/CreateCapacityStations.py
0 → 100644
View file @
bd7b85f5
from
copy
import
copy
import
json
import
time
import
random
import
operator
import
datetime
from
dream.plugins
import
plugin
class
CreateCapacityStations
(
plugin
.
InputPreparationPlugin
):
""" Input preparation
creates the CapacityStationBuffer and CapacityStationExit for each CapacityStation
"""
def
preprocess
(
self
,
data
):
nodes
=
copy
(
data
[
'graph'
][
'node'
])
for
(
stationId
,
node
)
in
nodes
.
iteritems
():
_class
=
node
[
'_class'
]
if
_class
==
'dream.simulation.applications.CapacityStations.CapacityStation.CapacityStation'
:
nextCapacityStationBufferId
=
self
.
getSuccessor
(
data
,
stationId
)
stationName
=
node
[
'name'
]
# create the CapacityStationBuffer
bufferName
=
stationName
+
'_Buffer'
bufferId
=
stationId
+
'_B'
data
[
'graph'
][
'node'
][
bufferId
]
=
{
"_class"
:
"dream.simulation.applications.CapacityStations.CapacityStationBuffer.CapacityStationBuffer"
,
"name"
:
bufferName
,
"wip"
:
[],
'requireFullProject'
:
data
[
'graph'
][
'node'
][
stationId
].
pop
(
'requireFullProject'
,
None
)
}
# create an edge that connects the CapacityStationBuffer to the CapacityStation
data
[
'graph'
][
'edge'
][
bufferId
+
'_to_'
+
stationId
]
=
{
"source"
:
bufferId
,
"destination"
:
stationId
,
"data"
:
{},
"_class"
:
"Dream.Edge"
}
# create the CapacityStationExit
exitName
=
stationName
+
'_Exit'
exitId
=
stationId
+
'_E'
data
[
'graph'
][
'node'
][
exitId
]
=
{
"_class"
:
"dream.simulation.applications.CapacityStations.CapacityStationExit.CapacityStationExit"
,
"name"
:
exitName
,
"nextCapacityStationBufferId"
:
nextCapacityStationBufferId
}
# create an edge that connects the CapacityStationBuffer to the CapacityStation
data
[
'graph'
][
'edge'
][
stationId
+
'_to_'
+
exitId
]
=
{
"source"
:
stationId
,
"destination"
:
exitId
,
"data"
:
{},
"_class"
:
"Dream.Edge"
}
print
'--->'
,(
data
[
'graph'
][
'node'
])
return
data
# gets the data and the stationId
# returns the successorId and erases the edge
def
getSuccessor
(
self
,
data
,
stationId
):
successorId
=
None
edgeToErase
=
None
for
(
edgeId
,
edge
)
in
data
[
'graph'
][
'edge'
].
iteritems
():
if
data
[
'graph'
][
'edge'
][
edgeId
][
'source'
]
==
stationId
:
successorId
=
data
[
'graph'
][
'edge'
][
edgeId
][
'destination'
]
edgeToErase
=
edgeId
break
if
edgeToErase
:
data
[
'graph'
][
'edge'
].
pop
(
edgeToErase
,
None
)
return
successorId
\ No newline at end of file
dream/simulation/Examples/CapacityProjectAllInOneEmpty.json
View file @
bd7b85f5
...
...
@@ -378,7 +378,7 @@
],
"description"
:
"Connect stations together"
},
"
Dream.Dream.Abstract
CapacityStation"
:
{
"
dream.simulation.applications.CapacityStations.CapacityStation.
CapacityStation"
:
{
"name"
:
"Machine"
,
"description"
:
"A station processing items for some time given by a distribution"
,
"_class"
:
"node"
,
...
...
@@ -403,9 +403,9 @@
"default"
:
"M"
,
"required"
:
true
},
"
Is an assembly station?
"
:
{
"
requireFullProject
"
:
{
"_default"
:
0
,
"description"
:
"Is this station an assembly
? Yes: 1, No: 0"
,
"description"
:
"Is this station an assembly? Yes: 1, No: 0"
,
"type"
:
"number"
,
"required"
:
true
}
...
...
@@ -647,6 +647,10 @@
{
"_class"
:
"dream.plugins.CapacityProjectSpreadsheet.CapacityProjectSpreadsheet"
,
"input_id"
:
"capacityProject"
},
{
"_class"
:
"dream.plugins.CreateCapacityStations.CreateCapacityStations"
,
"input_id"
:
"createCapacityStations"
}
]
},
...
...
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