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
Hide 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):
...
@@ -49,13 +49,15 @@ class CapacityStationController(EventGenerator):
if
self
.
stop
:
if
self
.
stop
:
if
self
.
env
.
now
>
self
.
stop
:
if
self
.
env
.
now
>
self
.
stop
:
break
break
# activate the main loop
self
.
env
.
process
(
self
.
steps
())
self
.
env
.
process
(
self
.
steps
())
# wait until the main loop is completed
yield
self
.
stepsAreComplete
yield
self
.
stepsAreComplete
self
.
stepsAreComplete
=
self
.
env
.
event
()
self
.
stepsAreComplete
=
self
.
env
.
event
()
yield
self
.
env
.
timeout
(
self
.
interval
)
#wait for the predetermined interval
yield
self
.
env
.
timeout
(
self
.
interval
)
#wait for the predetermined interval
def
steps
(
self
):
# the main loop that is carried in every interval
def
steps
(
self
):
# loop through the stations
# loop through the stations
for
station
in
G
.
CapacityStationList
:
for
station
in
G
.
CapacityStationList
:
exit
=
station
.
next
[
0
]
# take the exit
exit
=
station
.
next
[
0
]
# take the exit
...
@@ -72,6 +74,11 @@ class CapacityStationController(EventGenerator):
...
@@ -72,6 +74,11 @@ class CapacityStationController(EventGenerator):
# lock the exit again
# lock the exit again
exit
.
isLocked
=
True
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
# create the entities in the following stations
self
.
createInCapacityStationBuffers
()
self
.
createInCapacityStationBuffers
()
# if there is need to merge entities in a buffer
# if there is need to merge entities in a buffer
...
@@ -84,6 +91,7 @@ class CapacityStationController(EventGenerator):
...
@@ -84,6 +91,7 @@ class CapacityStationController(EventGenerator):
# and set the flags to the entities of StationBuffers
# and set the flags to the entities of StationBuffers
self
.
calculateWhatIsToBeProcessed
()
self
.
calculateWhatIsToBeProcessed
()
# move the entities into the stations
# loop through the stations
# loop through the stations
for
station
in
G
.
CapacityStationList
:
for
station
in
G
.
CapacityStationList
:
station
.
isLocked
=
False
# unlock the station
station
.
isLocked
=
False
# unlock the station
...
@@ -104,13 +112,9 @@ class CapacityStationController(EventGenerator):
...
@@ -104,13 +112,9 @@ class CapacityStationController(EventGenerator):
# for every station update the remaining interval capacity so that it is ready for next loop
# for every station update the remaining interval capacity so that it is ready for next loop
for
station
in
G
.
CapacityStationList
:
for
station
in
G
.
CapacityStationList
:
station
.
remainingIntervalCapacity
.
pop
(
0
)
station
.
remainingIntervalCapacity
.
pop
(
0
)
self
.
stepsAreComplete
.
succeed
()
# send message that the main loop is completed
def
checkIfStationsEmpty
(
self
):
self
.
stepsAreComplete
.
succeed
()
for
station
in
G
.
CapacityStationList
:
if
len
(
station
.
getActiveObjectQueue
()):
return
False
return
True
# invoked after entities have exited one station to create
# invoked after entities have exited one station to create
# the corresponding entities to the following buffer
# the corresponding entities to the following buffer
...
@@ -211,11 +215,12 @@ class CapacityStationController(EventGenerator):
...
@@ -211,11 +215,12 @@ class CapacityStationController(EventGenerator):
entityToCreate
.
currentStation
=
buffer
entityToCreate
.
currentStation
=
buffer
entityToCreate
.
initialize
()
entityToCreate
.
initialize
()
import
Globals
import
Globals
Globals
.
setWIP
([
entityToCreate
])
#set the new components as wip
Globals
.
setWIP
([
entityToCreate
])
#set the new components as wip
# checks if the system is empty so that the simulation can be stopped
def
checkIfBufferFinished
(
self
,
buffer
):
def
checkIfSystemEmpty
(
self
):
if
buffer
.
getActiveObjectQueue
():
for
object
in
G
.
CapacityStationList
+
G
.
CapacityStationBufferList
+
G
.
CapacityStationExitList
:
return
False
if
len
(
object
.
getActiveObjectQueue
()):
return
True
return
False
return
True
\ No newline at end of file
\ No newline at end of file
dream/simulation/LineGenerationJSON.py
View file @
5d8e0425
...
@@ -817,6 +817,7 @@ def createObjects():
...
@@ -817,6 +817,7 @@ def createObjects():
nextCapacityStationBufferId
=
element
.
get
(
'nextCapacityStationBufferId'
,
None
)
nextCapacityStationBufferId
=
element
.
get
(
'nextCapacityStationBufferId'
,
None
)
CE
=
CapacityStationExit
(
id
,
name
,
nextCapacityStationBufferId
=
nextCapacityStationBufferId
)
CE
=
CapacityStationExit
(
id
,
name
,
nextCapacityStationBufferId
=
nextCapacityStationBufferId
)
G
.
CapacityStationExitList
.
append
(
CE
)
G
.
CapacityStationExitList
.
append
(
CE
)
G
.
ExitList
.
append
(
CE
)
G
.
ObjList
.
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