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
bb25a077
Commit
bb25a077
authored
Aug 29, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Nov 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new methods added to Job to check the state of the requiredParts
parent
a4f36222
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
2 deletions
+81
-2
dream/simulation/Job.py
dream/simulation/Job.py
+81
-2
No files found.
dream/simulation/Job.py
View file @
bb25a077
...
...
@@ -117,7 +117,6 @@ class Job(Entity): # inherits from the Entity c
raise
SetWipTypeError
(
'The starting station of the the entity is not defined uniquely'
)
except
SetWipTypeError
as
setWipError
:
print
'WIP definition error: {0}'
.
format
(
setWipError
)
# self.currentStation=self.route[0][0]
#===========================================================================
# check if the entity can proceed to an operated machine, for use by Router
...
...
@@ -125,7 +124,87 @@ class Job(Entity): # inherits from the Entity c
def
canProceed
(
self
):
activeObject
=
self
.
currentStation
return
activeObject
.
canDeliver
(
self
)
#===========================================================================
# check if the requireParts of the entity next step sequence (route) have
# have concluded the steps with sequence numbers smaller than the sequence
# of the entity's next step in its route
#===========================================================================
def
checkIfRequiredPartsReady
(
self
):
# find the sequence of the next step in the route of the activeEntity
sequence
=
self
.
nextStepSequence
()
# assert that the sequence is not zero
assert
sequence
,
"the route sequence of the conditionalBuffer successor cannot be zero"
# flag that decides if the entity can proceed to the next station in its route
mayProceed
=
False
# find the required parts for the next step in the route (if any)
requiredParts
=
self
.
getRequiredParts
()
# if there are required parts
if
requiredParts
:
# for each requested part
for
part
in
requiredPartsIDs
:
# retrieve the current step sequence of the requiredPart
curStepSeq
=
part
.
currentStepSequence
()
# retrieve the next step sequence of the requiredParts
nextStepSeq
=
part
.
nextStepSequence
()
# if there is no next step sequence (route finished)
# it means that the part has exhausted its route
# if the sequence of the required part next step is smaller than the sequence of activeEntity's next step
# the activeEntity cannot proceed
if
nextStepSeq
>
sequence
or
not
nextStepSeq
:
# if the sequence of the requiredPart's currentStation is not zero then the
# required part is currently being processed and thus the activeEntity cannot proceed
if
not
curStepSeq
:
mayProceed
=
True
# if there are no requestedParts defined, then entity can proceed to the next step of its route
else
:
mayProceed
=
True
# if the local flag canProceed is true then return true
return
mayProceed
#===========================================================================
# method that returns the requiredParts
# of a blocked entity at its current step sequence
#===========================================================================
def
getRequiredParts
(
self
):
# retrieve the IDs of the required parts in the next step sequence
requiredPartsIDs
=
self
.
remainingRoute
[
0
].
get
(
'requiredParts'
,[])
requiredParts
=
[]
# if there are requested parts
if
requiredPartsIDs
:
from
Globals
import
findObjectById
for
partID
in
requiredPartsIDs
:
# find the objects with the corresponding IDs
part
=
findObjectById
(
partID
)
if
not
part
in
requiredParts
:
requiredParts
.
append
(
part
)
return
requiredParts
#===========================================================================
# method that returns the sequence of the entity's next step
#===========================================================================
def
nextStepSequence
(
self
):
# find the sequence of the next step in the route of the activeEntity
sequence
=
self
.
remainingRoute
[
0
].
get
(
'sequence'
,
0
)
return
sequence
#===========================================================================
# method that returns the sequence of the entity's current step
#===========================================================================
def
currentStepSequence
(
self
):
currentStation
=
self
.
currentStation
# the current station of the part
curStepSeq
=
0
# the sequence of the current process in the parts route
# if the part is being currently processed in a Station
from
Machine
import
Machine
if
issubclass
(
currentStation
.
__class__
,
Machine
):
for
routeStep
in
self
.
route
:
stepSeq
=
routeStep
.
get
(
'sequence'
,
0
)
stepIDs
=
routeStep
.
get
(
'stationIdsList'
,[])
if
currentStation
.
id
in
stepIDs
:
curStepSeq
=
stepSeq
break
return
curStepSeq
#===========================================================================
# method that finds a receiver for a candidate entity
#===========================================================================
...
...
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