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
6ddc3dae
Commit
6ddc3dae
authored
May 26, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
methods moved to Job from Entity
parent
18191053
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
32 deletions
+32
-32
dream/simulation/Entity.py
dream/simulation/Entity.py
+0
-32
dream/simulation/Job.py
dream/simulation/Job.py
+32
-0
No files found.
dream/simulation/Entity.py
View file @
6ddc3dae
...
@@ -69,38 +69,6 @@ class Entity(object):
...
@@ -69,38 +69,6 @@ class Entity(object):
self
.
receiver
=
None
self
.
receiver
=
None
self
.
timeOfAssignement
=
0
self
.
timeOfAssignement
=
0
#===========================================================================
# check if the entity can proceed to an operated machine, for use by Router
#===========================================================================
def
canProceed
(
self
):
activeObject
=
self
.
currentStation
return
activeObject
.
canDeliver
(
self
)
#===========================================================================
# method that finds a receiver for a candidate entity
#===========================================================================
def
findCandidateReceiver
(
self
):
from
Globals
import
G
router
=
G
.
Router
# initiate the local list variable available receivers
availableReceivers
=
[
x
for
x
in
self
.
candidateReceivers
\
if
not
x
in
router
.
occupiedReceivers
]
# and pick the object that is waiting for the most time
if
availableReceivers
:
# find the receiver that waits the most
availableReceiver
=
self
.
currentStation
.
selectReceiver
(
availableReceivers
)
router
.
occupiedReceivers
.
append
(
availableReceiver
)
# if there is no available receiver add the entity to the entitiesWithOccupiedReceivers list
else
:
router
.
entitiesWithOccupiedReceivers
.
append
(
self
)
availableReceiver
=
None
# if the sorting flag is not set then the sorting of each queue must prevail in case of operators conflict
if
not
router
.
sorting
and
not
availableReceiver
and
bool
(
availableReceivers
):
availableReceiver
=
self
.
currentStation
.
selectReceiver
(
self
.
candidateReceivers
)
if
not
self
in
router
.
conflictingEntities
:
router
.
conflictingEntities
.
append
(
self
)
return
availableReceiver
# =======================================================================
# =======================================================================
# outputs results to JSON File
# outputs results to JSON File
# =======================================================================
# =======================================================================
...
...
dream/simulation/Job.py
View file @
6ddc3dae
...
@@ -116,3 +116,35 @@ class Job(Entity): # inherits from the Entity c
...
@@ -116,3 +116,35 @@ class Job(Entity): # inherits from the Entity c
print
'WIP definition error: {0}'
.
format
(
setWipError
)
print
'WIP definition error: {0}'
.
format
(
setWipError
)
# self.currentStation=self.route[0][0]
# self.currentStation=self.route[0][0]
#===========================================================================
# check if the entity can proceed to an operated machine, for use by Router
#===========================================================================
def
canProceed
(
self
):
activeObject
=
self
.
currentStation
return
activeObject
.
canDeliver
(
self
)
#===========================================================================
# method that finds a receiver for a candidate entity
#===========================================================================
def
findCandidateReceiver
(
self
):
from
Globals
import
G
router
=
G
.
Router
# initiate the local list variable available receivers
availableReceivers
=
[
x
for
x
in
self
.
candidateReceivers
\
if
not
x
in
router
.
occupiedReceivers
]
# and pick the object that is waiting for the most time
if
availableReceivers
:
# find the receiver that waits the most
availableReceiver
=
self
.
currentStation
.
selectReceiver
(
availableReceivers
)
router
.
occupiedReceivers
.
append
(
availableReceiver
)
# if there is no available receiver add the entity to the entitiesWithOccupiedReceivers list
else
:
router
.
entitiesWithOccupiedReceivers
.
append
(
self
)
availableReceiver
=
None
# if the sorting flag is not set then the sorting of each queue must prevail in case of operators conflict
if
not
router
.
sorting
and
not
availableReceiver
and
bool
(
availableReceivers
):
availableReceiver
=
self
.
currentStation
.
selectReceiver
(
self
.
candidateReceivers
)
if
not
self
in
router
.
conflictingEntities
:
router
.
conflictingEntities
.
append
(
self
)
return
availableReceiver
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