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
43791a98
Commit
43791a98
authored
Dec 11, 2016
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conveyer: make sure that canMove event is sent to ConveyerMover only when it should
I.e. only when it is expected by the mover
parent
c1c384a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+7
-5
No files found.
dream/simulation/Conveyer.py
View file @
43791a98
...
@@ -99,11 +99,11 @@ class Conveyer(CoreObject):
...
@@ -99,11 +99,11 @@ class Conveyer(CoreObject):
while
1
:
while
1
:
#calculate the time to reach end. If this is greater than 0 (we did not already have an entity at the end)
#calculate the time to reach end. If this is greater than 0 (we did not already have an entity at the end)
#set it as the timeToWait of the conveyerMover and raise call=true so that it will be triggered
#set it as the timeToWait of the conveyerMover and raise call=true so that it will be triggered
if
self
.
updateMoveTime
()
:
if
self
.
updateMoveTime
()
and
self
.
conveyerMover
.
expectedSignals
[
'canMove'
]:
# print self.id, 'time to move', self.conveyerMover.timeToWait
# print self.id, 'time to move', self.conveyerMover.timeToWait
succeedTuple
=
(
self
,
self
.
env
.
now
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
conveyerMover
.
canMove
.
succeed
(
succeedTuple
)
self
.
conveyerMover
.
canMove
.
succeed
(
succeedTuple
)
self
.
printTrace
(
self
.
id
,
waitEvent
=
''
)
self
.
printTrace
(
self
.
id
,
waitEvent
=
''
)
self
.
expectedSignals
[
'isRequested'
]
=
1
self
.
expectedSignals
[
'isRequested'
]
=
1
...
@@ -369,8 +369,7 @@ class Conveyer(CoreObject):
...
@@ -369,8 +369,7 @@ class Conveyer(CoreObject):
# self.totalBlockageTime+=self.env.now-self.timeBlockageStarted
# self.totalBlockageTime+=self.env.now-self.timeBlockageStarted
self
.
wasFull
=
False
self
.
wasFull
=
False
#calculate the time that the conveyer will become available again and trigger the conveyerMover
#calculate the time that the conveyer will become available again and trigger the conveyerMover
if
self
.
updateMoveTime
():
if
self
.
updateMoveTime
()
and
self
.
conveyerMover
.
expectedSignals
[
'canMove'
]:
# print self.id, 'time to move', self.conveyerMover.timeToWait
succeedTuple
=
(
self
,
self
.
env
.
now
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
conveyerMover
.
canMove
.
succeed
(
succeedTuple
)
self
.
conveyerMover
.
canMove
.
succeed
(
succeedTuple
)
# if there is anything to dispose of then signal a receiver
# if there is anything to dispose of then signal a receiver
...
@@ -472,15 +471,18 @@ class ConveyerMover(object):
...
@@ -472,15 +471,18 @@ class ConveyerMover(object):
self
.
timeToWait
=
0
#the time to wait every time. This is calculated by the conveyer and corresponds
self
.
timeToWait
=
0
#the time to wait every time. This is calculated by the conveyer and corresponds
#either to the time that one entity reaches the end or the time that one space is freed
#either to the time that one entity reaches the end or the time that one space is freed
self
.
canMove
=
self
.
env
.
event
()
self
.
canMove
=
self
.
env
.
event
()
self
.
expectedSignals
=
{
'canMove'
:
1
}
#===========================================================================
#===========================================================================
# ConveyerMover generator
# ConveyerMover generator
#===========================================================================
#===========================================================================
def
run
(
self
):
def
run
(
self
):
while
1
:
while
1
:
self
.
conveyer
.
printTrace
(
self
.
conveyer
.
id
,
waitEvent
=
'(canMove)'
)
self
.
conveyer
.
printTrace
(
self
.
conveyer
.
id
,
waitEvent
=
'(canMove)'
)
self
.
expectedSignals
[
'canMove'
]
=
1
yield
self
.
canMove
#wait until the conveyer triggers the mover
yield
self
.
canMove
#wait until the conveyer triggers the mover
transmitter
,
eventTime
=
self
.
canMove
.
value
transmitter
,
eventTime
=
self
.
canMove
.
value
self
.
expectedSignals
[
'canMove'
]
=
0
self
.
canMove
=
self
.
env
.
event
()
self
.
canMove
=
self
.
env
.
event
()
self
.
conveyer
.
printTrace
(
self
.
conveyer
.
id
,
received
=
'(canMove)'
)
self
.
conveyer
.
printTrace
(
self
.
conveyer
.
id
,
received
=
'(canMove)'
)
...
...
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