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
e8cef93c
Commit
e8cef93c
authored
May 16, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new method canEntityProceed added for the jobshop case
parent
04fa9d7e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
118 additions
and
28 deletions
+118
-28
dream/simulation/ConditionalBuffer.py
dream/simulation/ConditionalBuffer.py
+24
-0
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+6
-0
dream/simulation/Machine.py
dream/simulation/Machine.py
+18
-0
dream/simulation/MouldAssemblyBuffer.py
dream/simulation/MouldAssemblyBuffer.py
+20
-0
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+33
-28
dream/simulation/Queue.py
dream/simulation/Queue.py
+17
-0
No files found.
dream/simulation/ConditionalBuffer.py
View file @
e8cef93c
...
...
@@ -156,3 +156,27 @@ class ConditionalBuffer(QueueManagedJob):
and
\
x
.
order
.
basicsEnded
),
reverse
=
True
)
# activeObjectQueue.sort(key=lambda x: x.managerAvailable, reverse=True)
#===========================================================================
# checks whether the entity can proceed to a successor object
#===========================================================================
def
canEntityProceed
(
self
,
entity
=
None
):
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
assert
entity
in
activeObjectQueue
,
entity
.
id
+
' not in the internalQueue of'
+
activeObject
.
id
activeEntity
=
entity
# for entities of type OrderComponent, if they reside at a conditionalBuffer,
# they must wait till their basicsEnded flag is raised
if
activeEntity
.
type
==
'OrderComponent'
:
if
(
activeEntity
.
componentType
==
'Secondary'
\
and
activeEntity
.
order
.
basicsEnded
==
False
):
return
False
mayProceed
=
False
# for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity
for
nextObject
in
[
object
for
object
in
activeObject
.
next
if
object
.
canAcceptEntity
(
activeEntity
)]:
activeEntity
.
canProceed
=
True
activeEntity
.
candidateReceivers
.
append
(
nextObject
)
mayProceed
=
True
return
mayProceed
\ No newline at end of file
dream/simulation/CoreObject.py
View file @
e8cef93c
...
...
@@ -469,6 +469,12 @@ class CoreObject(Process):
maxTimeWaiting
=
timeWaiting
return
giver
#===========================================================================
# checks whether the entity can proceed to a successor object
#===========================================================================
def
canEntityProceed
(
self
):
pass
# =======================================================================
# actions to be taken after the simulation ends
# =======================================================================
...
...
dream/simulation/Machine.py
View file @
e8cef93c
...
...
@@ -798,6 +798,24 @@ class Machine(CoreObject):
candidateOperator
.
candidateStations
.
append
(
activeObject
)
return
candidateOperator
#===========================================================================
# checks whether the entity can proceed to a successor object
#===========================================================================
def
canEntityProceed
(
self
,
entity
=
None
):
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
assert
entity
in
activeObjectQueue
,
entity
.
id
+
' not in the internalQueue of'
+
activeObject
.
id
activeEntity
=
entity
from
Globals
import
G
router
=
G
.
Router
# if the entity is in a machines who's broker waits for operator then
if
activeObject
in
router
.
pendingMachines
:
activeEntity
.
canProceed
=
True
activeEntity
.
candidateReceivers
.
append
(
activeObject
)
return
True
return
False
# =======================================================================
# prepare the machine to be operated
# =======================================================================
...
...
dream/simulation/MouldAssemblyBuffer.py
View file @
e8cef93c
...
...
@@ -180,3 +180,23 @@ class MouldAssemblyBuffer(QueueManagedJob):
return
thecaller
.
isInRoute
(
activeObject
)
\
and
thecaller
.
getActiveObjectQueue
()[
0
].
order
is
activeEntity
.
order
\
and
activeEntity
.
order
.
componentsReadyForAssembly
#===========================================================================
# checks whether the entity can proceed to a successor object
#===========================================================================
def
canEntityProceed
(
self
,
entity
=
None
):
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
assert
entity
in
activeObjectQueue
,
entity
.
id
+
' not in the internalQueue of'
+
activeObject
.
id
activeEntity
=
entity
# unassembled components of a mould must wait at a MouldAssemblyBuffer till the componentsReadyForAssembly flag is raised
if
not
activeEntity
.
order
.
componentsReadyForAssembly
:
return
False
mayProceed
=
False
# for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity
for
nextObject
in
[
object
for
object
in
activeObject
.
next
if
object
.
canAcceptEntity
(
activeEntity
)]:
activeEntity
.
canProceed
=
True
activeEntity
.
candidateReceivers
.
append
(
nextObject
)
mayProceed
=
True
return
mayProceed
dream/simulation/OperatorRouter.py
View file @
e8cef93c
...
...
@@ -384,35 +384,43 @@ class Router(ObjectInterruption):
for
entity
in
[
x
for
x
in
self
.
pending
if
x
.
manager
]:
# if the entity is ready to move to a machine and its manager is available
if
entity
.
manager
.
checkIfResourceIsAvailable
():
# for entities of type OrderComponent, if they reside at a conditionalBuffer,
# they must wait till their basicsEnded flag is raised
if
entity
.
type
==
'OrderComponent'
:
from
ConditionalBuffer
import
ConditionalBuffer
if
(
entity
.
componentType
==
'Secondary'
\
and
type
(
entity
.
currentStation
)
is
ConditionalBuffer
\
and
entity
.
order
.
basicsEnded
==
False
):
continue
# unassembled components of a mould must wait at a MouldAssemblyBuffer till the componentsReadyForAssembly flag is raised
from
MouldAssemblyBuffer
import
MouldAssemblyBuffer
if
type
(
entity
.
currentStation
)
is
MouldAssemblyBuffer
:
if
not
entity
.
order
.
componentsReadyForAssembly
:
continue
# for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity
if
not
entity
.
currentStation
in
self
.
pendingMachines
:
for
nextObject
in
[
object
for
object
in
entity
.
currentStation
.
next
if
object
.
canAcceptEntity
(
entity
)]:
entity
.
canProceed
=
True
entity
.
candidateReceivers
.
append
(
nextObject
)
# if the entity is in a machines who's broker waits for operator then
if
entity
.
currentStation
in
self
.
pendingMachines
:
entity
.
canProceed
=
True
entity
.
candidateReceivers
.
append
(
entity
.
currentStation
)
# if the entity can proceed, add its manager to the candidateOperators list
if
entity
.
canProceed
and
not
entity
.
manager
in
self
.
candidateOperators
:
# check whether the entity canProceed and update the its candidateReceivers
if
entity
.
currentStation
.
canEntityProceed
(
entity
)
\
and
not
entity
.
manager
in
self
.
candidateOperators
:
self
.
candidateOperators
.
append
(
entity
.
manager
)
# # for entities of type OrderComponent, if they reside at a conditionalBuffer,
# # they must wait till their basicsEnded flag is raised
# if entity.type=='OrderComponent':
# from ConditionalBuffer import ConditionalBuffer
# if (entity.componentType=='Secondary'\
# and type(entity.currentStation) is ConditionalBuffer\
# and entity.order.basicsEnded==False):
# continue
# # unassembled components of a mould must wait at a MouldAssemblyBuffer till the componentsReadyForAssembly flag is raised
# from MouldAssemblyBuffer import MouldAssemblyBuffer
# if type(entity.currentStation) is MouldAssemblyBuffer:
# if not entity.order.componentsReadyForAssembly:
# continue
# # for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity
# if not entity.currentStation in self.pendingMachines:
# for nextObject in [object for object in entity.currentStation.next if object.canAcceptEntity(entity)]:
# entity.canProceed=True
# entity.candidateReceivers.append(nextObject)
# # if the entity is in a machines who's broker waits for operator then
# if entity.currentStation in self.pendingMachines:
# entity.canProceed=True
# entity.candidateReceivers.append(entity.currentStation)
#
# # if the entity can proceed, add its manager to the candidateOperators list
# if entity.canProceed and not entity.manager in self.candidateOperators:
# self.candidateOperators.append(entity.manager)
# update the schedulingRule/multipleCriterionList of the Router
if
self
.
sorting
:
self
.
updateSchedulingRule
()
# find the candidateEntities for each operator
self
.
findCandidateEntities
()
#=======================================================================
# # testing
...
...
@@ -430,9 +438,6 @@ class Router(ObjectInterruption):
for
operator
in
self
.
candidateOperators
:
# find which pendingEntities that can move to machines is the operator managing
operator
.
pickCandidateEntitiesFrom
(
self
.
pending
)
# for entity in [x for x in self.pending if x.canProceed and x.manager==operator]:
# operator.candidateEntities.append(entity)
# print ' ', [x.id for x in operator.candidateEntities]
#=======================================================================
# find the schedulingRules of the candidateOperators
...
...
dream/simulation/Queue.py
View file @
e8cef93c
...
...
@@ -197,6 +197,23 @@ class Queue(CoreObject):
def
getEntity
(
self
):
activeEntity
=
CoreObject
.
getEntity
(
self
)
#run the default behavior
return
activeEntity
#===========================================================================
# checks whether the entity can proceed to a successor object
#===========================================================================
def
canEntityProceed
(
self
,
entity
=
None
):
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
assert
entity
in
activeObjectQueue
,
entity
.
id
+
' not in the internalQueue of'
+
activeObject
.
id
activeEntity
=
entity
mayProceed
=
False
# for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity
for
nextObject
in
[
object
for
object
in
activeObject
.
next
if
object
.
canAcceptEntity
(
activeEntity
)]:
activeEntity
.
canProceed
=
True
activeEntity
.
candidateReceivers
.
append
(
nextObject
)
mayProceed
=
True
return
mayProceed
# =======================================================================
# sorts the Entities of the Queue according to the scheduling rule
...
...
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