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
94a1070f
Commit
94a1070f
authored
Sep 02, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
example update
parent
0f212bec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
dream/simulation/Examples/BalancingABuffer.py
dream/simulation/Examples/BalancingABuffer.py
+7
-2
No files found.
dream/simulation/Examples/BalancingABuffer.py
View file @
94a1070f
from
dream.simulation.imports
import
Machine
,
Queue
,
Exit
,
Part
,
EventGenerator
from
dream.simulation.Globals
import
runSimulation
,
G
from
dream.simulation.Globals
import
runSimulation
,
setWIP
,
G
# method to check if the buffer is starving and refill it
def
balanceQueue
(
buffer
,
refillLevel
=
1
):
# get the internal queue of the buffer
objectQueue
=
buffer
.
getActiveObjectQueue
()
numInQueue
=
len
(
objectQueue
)
print
'-'
*
50
...
...
@@ -10,10 +11,13 @@ def balanceQueue(buffer, refillLevel=1):
if
numInQueue
==
0
:
print
'buffer is starving, I will bring 5 parts'
for
i
in
range
(
refillLevel
):
# calculate the id and name of the new part
partId
=
'P'
+
str
(
G
.
numOfParts
)
partName
=
'Part'
+
str
(
G
.
numOfParts
)
# create the Part
P
=
Part
(
partId
,
partName
,
currentStation
=
buffer
)
objectQueue
.
append
(
P
)
# set the part as WIP
setWIP
([
P
])
G
.
numOfParts
+=
1
# send a signal to the buffer that it can dispose an Entity
buffer
.
canDispose
.
succeed
(
G
.
env
.
now
)
...
...
@@ -27,6 +31,7 @@ E=Exit('E1','Exit')
EV
=
EventGenerator
(
'EV'
,
'EntityCreator'
,
start
=
0
,
stop
=
float
(
'inf'
),
interval
=
20
,
method
=
balanceQueue
,
argumentDict
=
{
'buffer'
:
Q
,
'refillLevel'
:
5
})
# counter used in order to give parts meaningful ids (e.g P1, P2...) and names (e.g. Part1, Part2...)
G
.
numOfParts
=
0
#define predecessors and successors for the objects
...
...
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