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
f82e0286
Commit
f82e0286
authored
May 22, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conveyer - updateMoveTime() makes use of findRequestedLength()
parent
6892ac04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+11
-9
No files found.
dream/simulation/Conveyer.py
View file @
f82e0286
...
...
@@ -148,11 +148,13 @@ class Conveyer(CoreObject):
if
self
.
position
:
if
(
not
self
.
length
-
self
.
position
[
0
]
<
0.000001
):
timeToReachEnd
=
((
self
.
length
-
self
.
position
[
0
])
/
float
(
self
.
speed
))
/
60
# find the requested length
requestedLength
=
self
.
findRequestedLength
()
# calculate time to become available
timeToBecomeAvailable
=
0
if
self
.
position
:
if
self
.
currentR
equestedLength
>
self
.
position
[
-
1
]:
timeToBecomeAvailable
=
((
self
.
currentR
equestedLength
-
self
.
position
[
-
1
])
/
float
(
self
.
speed
))
/
60
if
r
equestedLength
>
self
.
position
[
-
1
]:
timeToBecomeAvailable
=
((
r
equestedLength
-
self
.
position
[
-
1
])
/
float
(
self
.
speed
))
/
60
# pick the smallest but not zero
timeToWait
=
0
if
timeToReachEnd
>
0
:
...
...
@@ -168,17 +170,21 @@ class Conveyer(CoreObject):
#===========================================================================
# calculate the requested length
#===========================================================================
def
r
equestedLength
(
self
):
def
findR
equestedLength
(
self
):
minRequestedLength
=
0
for
object
in
[
x
for
x
in
self
.
previous
if
x
.
getActiveObjectQueue
()]:
requestedLength
=
0
# search ammong the predecessors that have something to give
for
object
in
[
x
for
x
in
self
.
previous
if
x
.
haveToDispose
()]:
#update the requested Length
requestedLength
=
object
.
getActiveObjectQueue
()[
0
].
length
# if the min requested length is not zero check if the current requested is smaller
if
minRequestedLength
:
if
requestedLength
<
minRequestedLength
and
requestedLength
!=
0
:
minRequestedLength
=
requestedLength
# otherwise check if current requested length is not zero
else
:
if
requestedLength
>
0
:
minRequestedLength
=
requestedLength
print
'requested length'
,
requestedLength
return
minRequestedLength
#===========================================================================
...
...
@@ -289,10 +295,6 @@ class Conveyer(CoreObject):
return
False
activeEntity
=
thecallerQueue
[
0
]
requestedLength
=
activeEntity
.
length
#read what length the entity has
# append entity to the requestingEntities list
self
.
requestingEntities
.
append
(
activeEntity
)
# print self.id, 'requested length', requestedLength
self
.
currentRequestedLength
=
requestedLength
availableLength
=
self
.
currentAvailableLength
#in plant an entity can be accepted even if the available length is exactly zero
#eg if the conveyer has 8m length and the entities 1m length it can have up to 9 entities.
...
...
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