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
5d8e0425
Commit
5d8e0425
authored
Jun 10, 2014
by
Georgios Dagkakis
Committed by
Jérome Perrin
Jun 10, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes so that the system can run for infinite time and end when it gets empty
parent
c69bbc2a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
17 deletions
+23
-17
dream/simulation/CapacityStationController.py
dream/simulation/CapacityStationController.py
+22
-17
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+1
-0
No files found.
dream/simulation/CapacityStationController.py
View file @
5d8e0425
...
...
@@ -49,13 +49,15 @@ class CapacityStationController(EventGenerator):
if
self
.
stop
:
if
self
.
env
.
now
>
self
.
stop
:
break
# activate the main loop
self
.
env
.
process
(
self
.
steps
())
# wait until the main loop is completed
yield
self
.
stepsAreComplete
self
.
stepsAreComplete
=
self
.
env
.
event
()
yield
self
.
env
.
timeout
(
self
.
interval
)
#wait for the predetermined interval
# the main loop that is carried in every interval
def
steps
(
self
):
# loop through the stations
for
station
in
G
.
CapacityStationList
:
exit
=
station
.
next
[
0
]
# take the exit
...
...
@@ -72,6 +74,11 @@ class CapacityStationController(EventGenerator):
# lock the exit again
exit
.
isLocked
=
True
# if the last exits led to an empty system then the simulation must be stopped
# step returns and the generator never yields the stepsAreComplete signal
if
self
.
checkIfSystemEmpty
():
return
# create the entities in the following stations
self
.
createInCapacityStationBuffers
()
# if there is need to merge entities in a buffer
...
...
@@ -84,6 +91,7 @@ class CapacityStationController(EventGenerator):
# and set the flags to the entities of StationBuffers
self
.
calculateWhatIsToBeProcessed
()
# move the entities into the stations
# loop through the stations
for
station
in
G
.
CapacityStationList
:
station
.
isLocked
=
False
# unlock the station
...
...
@@ -104,13 +112,9 @@ class CapacityStationController(EventGenerator):
# for every station update the remaining interval capacity so that it is ready for next loop
for
station
in
G
.
CapacityStationList
:
station
.
remainingIntervalCapacity
.
pop
(
0
)
self
.
stepsAreComplete
.
succeed
()
def
checkIfStationsEmpty
(
self
):
for
station
in
G
.
CapacityStationList
:
if
len
(
station
.
getActiveObjectQueue
()):
return
False
return
True
# send message that the main loop is completed
self
.
stepsAreComplete
.
succeed
()
# invoked after entities have exited one station to create
# the corresponding entities to the following buffer
...
...
@@ -213,9 +217,10 @@ class CapacityStationController(EventGenerator):
import
Globals
Globals
.
setWIP
([
entityToCreate
])
#set the new components as wip
def
checkIfBufferFinished
(
self
,
buffer
):
if
buffer
.
getActiveObjectQueue
():
# checks if the system is empty so that the simulation can be stopped
def
checkIfSystemEmpty
(
self
):
for
object
in
G
.
CapacityStationList
+
G
.
CapacityStationBufferList
+
G
.
CapacityStationExitList
:
if
len
(
object
.
getActiveObjectQueue
()):
return
False
return
True
\ No newline at end of file
dream/simulation/LineGenerationJSON.py
View file @
5d8e0425
...
...
@@ -817,6 +817,7 @@ def createObjects():
nextCapacityStationBufferId
=
element
.
get
(
'nextCapacityStationBufferId'
,
None
)
CE
=
CapacityStationExit
(
id
,
name
,
nextCapacityStationBufferId
=
nextCapacityStationBufferId
)
G
.
CapacityStationExitList
.
append
(
CE
)
G
.
ExitList
.
append
(
CE
)
G
.
ObjList
.
append
(
CE
)
# -----------------------------------------------------------------------
...
...
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