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
c3dfe7ff
Commit
c3dfe7ff
authored
Dec 16, 2013
by
Georgios Dagkakis
Committed by
Jérome Perrin
Jan 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Line clearance enhancement and predecessorIndex removal
parent
312659ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
dream/simulation/LineClearance.py
dream/simulation/LineClearance.py
+10
-12
No files found.
dream/simulation/LineClearance.py
View file @
c3dfe7ff
...
...
@@ -36,7 +36,7 @@ class LineClearance(Queue):
# =======================================================================
# checks if the Queue can accept an entity
# it checks also who called it and returns TRUE
# only to the p
redecesso
r that will give the entity.
# only to the p
otential give
r that will give the entity.
# =======================================================================
def
canAccept
(
self
,
callerObject
=
None
):
# get active and giver objects
...
...
@@ -45,7 +45,7 @@ class LineClearance(Queue):
giverObject
=
self
.
getGiverObject
()
giverObjectQueue
=
self
.
getGiverObjectQueue
()
#if we have only one p
redecesso
r just check if there is a place available
#if we have only one p
otential give
r just check if there is a place available
# this is done to achieve better (cpu) processing time
# then we can also use it as a filter for a yield method
if
(
len
(
activeObject
.
previous
)
==
1
or
callerObject
==
None
):
...
...
@@ -64,7 +64,7 @@ class LineClearance(Queue):
thecaller
=
callerObject
#return true only to the p
redecesso
r from which the queue will take
#return true only to the p
otential give
r from which the queue will take
#flag=False
#if thecaller is self.previous[self.predecessorIndex]:
# flag=True
...
...
@@ -87,7 +87,7 @@ class LineClearance(Queue):
giverObject
=
self
.
getGiverObject
()
giverObjectQueue
=
self
.
getGiverObjectQueue
()
#if we have only one p
redecessor just check if there is a place available and the predecesso
r has an entity to dispose
#if we have only one p
otential giver just check if there is a place available and the potential give
r has an entity to dispose
if
(
len
(
activeObject
.
previous
)
==
1
):
if
len
(
activeObjectQueue
)
==
0
:
return
giverObject
.
haveToDispose
(
activeObject
)
and
\
...
...
@@ -98,11 +98,10 @@ class LineClearance(Queue):
giverObjectQueue
[
0
].
type
==
'SubBatch'
and
\
giverObjectQueue
[
0
].
batchId
==
activeObjectQueue
[
0
].
batchId
isRequested
=
False
# dummy boolean variable to check if any p
redecesso
r has something to hand in
maxTimeWaiting
=
0
# dummy timer to check which p
redecesso
r has been waiting the most
isRequested
=
False
# dummy boolean variable to check if any p
otential give
r has something to hand in
maxTimeWaiting
=
0
# dummy timer to check which p
otential give
r has been waiting the most
#loop through the predecessors to see which have to dispose and which is the one blocked for longer
i
=
0
# loop through all the predecessors
#loop through the potential givers to see which have to dispose and which is the one blocked for longer
for
object
in
activeObject
.
previous
:
if
(
object
.
haveToDispose
(
activeObject
)):
# if they have something to dispose off
isRequested
=
True
# then the Queue is requested to handle the entity
...
...
@@ -111,11 +110,10 @@ class LineClearance(Queue):
else
:
# of the other machines
timeWaiting
=
now
()
-
object
.
timeLastEntityEnded
#if more than one p
redecesso
r have to dispose take the part from the one that is blocked longer
#if more than one p
otential give
r have to dispose take the part from the one that is blocked longer
if
(
timeWaiting
>=
maxTimeWaiting
):
activeObject
.
predecessorIndex
=
i
activeObject
.
giver
=
object
maxTimeWaiting
=
timeWaiting
i
+=
1
# pick the predecessor waiting the more return
# true when the Queue is not fully occupied and
# a predecessor is requesting it
if
len
(
activeObjectQueue
)
==
0
:
...
...
@@ -125,4 +123,4 @@ class LineClearance(Queue):
return
len
(
activeObjectQueue
)
<
self
.
capacity
and
\
isRequested
and
\
activeObject
.
getGiverObjectQueue
()[
0
].
type
==
'SubBatch'
and
\
activeObject
.
getGiverObjectQueue
()[
0
].
batchId
==
activeObjectQueue
[
0
].
batchId
\ No newline at end of file
activeObject
.
getGiverObjectQueue
()[
0
].
batchId
==
activeObjectQueue
[
0
].
batchId
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