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
10fa0a8c
Commit
10fa0a8c
authored
May 15, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
signalRouter and sortEntitiesForReceiver methods added
parent
06b7c16e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
78 deletions
+75
-78
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+33
-18
dream/simulation/Machine.py
dream/simulation/Machine.py
+7
-0
dream/simulation/QueueManagedJob.py
dream/simulation/QueueManagedJob.py
+35
-60
No files found.
dream/simulation/CoreObject.py
View file @
10fa0a8c
...
@@ -348,24 +348,11 @@ class CoreObject(Process):
...
@@ -348,24 +348,11 @@ class CoreObject(Process):
return
False
return
False
receiver
=
activeObject
.
selectReceiver
(
possibleReceivers
)
receiver
=
activeObject
.
selectReceiver
(
possibleReceivers
)
receiversGiver
=
activeObject
receiversGiver
=
activeObject
# sorting the entities of the object for the receiver
#------------------------------------------------------------------------------
activeObject
.
sortEntitiesForReceiver
(
receiver
)
# if an operator is not assigned to the receiver then do not signal the receiver but the Router
# signalling the Router if the receiver is operated and not assigned an operator
try
:
if
activeObject
.
signalRouter
(
receiver
):
if
not
receiver
.
assignedOperator
:
return
False
if
any
(
type
==
'Load'
or
type
==
'Setup'
for
type
in
receiver
.
multOperationTypeList
):
from
Globals
import
G
if
not
G
.
Router
.
invoked
:
#===================================================================
# # TESTING
# print now(), self.id,' '*50, 'signalling router'
#===================================================================
G
.
Router
.
invoked
=
True
G
.
Router
.
isCalled
.
signal
(
now
())
return
False
except
:
pass
#------------------------------------------------------------------------------
activeObject
.
receiver
=
receiver
activeObject
.
receiver
=
receiver
activeObject
.
receiver
.
giver
=
activeObject
activeObject
.
receiver
.
giver
=
activeObject
...
@@ -395,6 +382,34 @@ class CoreObject(Process):
...
@@ -395,6 +382,34 @@ class CoreObject(Process):
receiver
=
object
# set the receiver as the longest waiting possible receiver
receiver
=
object
# set the receiver as the longest waiting possible receiver
return
receiver
return
receiver
#===========================================================================
# signalRouter method
#===========================================================================
def
signalRouter
(
self
,
receiver
=
None
):
# if an operator is not assigned to the receiver then do not signal the receiver but the Router
try
:
if
not
receiver
.
assignedOperator
:
if
receiver
.
isLoadRequested
():
from
Globals
import
G
if
not
G
.
Router
.
invoked
:
#===================================================================
# # TESTING
# print now(), self.id,' '*50, 'signalling router'
#===================================================================
G
.
Router
.
invoked
=
True
G
.
Router
.
isCalled
.
signal
(
now
())
return
True
else
:
return
False
except
:
return
False
#===========================================================================
# sort the entities of the queue for the receiver
#===========================================================================
def
sortEntitiesForReceiver
(
self
,
receiver
=
None
):
pass
#===========================================================================
#===========================================================================
# find possible givers
# find possible givers
#===========================================================================
#===========================================================================
...
...
dream/simulation/Machine.py
View file @
10fa0a8c
...
@@ -689,6 +689,13 @@ class Machine(CoreObject):
...
@@ -689,6 +689,13 @@ class Machine(CoreObject):
return
False
return
False
return
True
return
True
#===========================================================================
# return whether Load or setup Requested
#===========================================================================
def
isLoadRequested
(
self
):
activeObject
=
self
.
getActiveObject
()
return
any
(
type
==
'Load'
or
type
==
'Setup'
for
type
in
activeObject
.
multOperationTypeList
)
# =======================================================================
# =======================================================================
# to be called by canAcceptAndIsRequested and check for the operator
# to be called by canAcceptAndIsRequested and check for the operator
# =======================================================================
# =======================================================================
...
...
dream/simulation/QueueManagedJob.py
View file @
10fa0a8c
...
@@ -100,68 +100,31 @@ class QueueManagedJob(QueueJobShop):
...
@@ -100,68 +100,31 @@ class QueueManagedJob(QueueJobShop):
# return len(activeObjectQueue)>0\
# return len(activeObjectQueue)>0\
# and (thecaller in activeObject.next)\
# and (thecaller in activeObject.next)\
# and thecaller.isInRoute(activeObject)
# and thecaller.isInRoute(activeObject)
#===========================================================================
#===========================================================================
#
signalReceiver M
ethod
#
signalRouter m
ethod
#===========================================================================
#===========================================================================
def
signalReceiver
(
self
):
def
signalRouter
(
self
,
receiver
=
None
):
# print now(), self.id, 'trying to signal receiver'
# if an operator is not assigned to the receiver then do not signal the receiver but the Router
activeObject
=
self
.
getActiveObject
()
# TODO: identifyEntityToGet needs giver defined but here is not yet defined for Machines and machineJobShops
possibleReceivers
=
[]
try
:
for
object
in
[
x
for
x
in
self
.
next
if
x
.
canAccept
(
activeObject
)]:
if
receiver
.
identifyEntityToGet
().
manager
:
possibleReceivers
.
append
(
object
)
if
receiver
.
isLoadRequested
():
if
possibleReceivers
:
if
receiver
.
identifyEntityToGet
().
manager
.
isAssignedTo
()
!=
receiver
:
receiver
=
activeObject
.
selectReceiver
(
possibleReceivers
)
from
Globals
import
G
receiversGiver
=
activeObject
if
not
G
.
Router
.
invoked
:
# perform the checks that canAcceptAndIsRequested used to perform and update assignExit and operatorPool
#===================================================================
while
not
receiver
.
canAcceptAndIsRequested
(
receiversGiver
):
# # TESTING
# print 'removing receiver from possibleReceivrs', receiver.id
# print now(), self.id,' '*50, 'signalling router'
possibleReceivers
.
remove
(
receiver
)
#===================================================================
if
not
possibleReceivers
:
G
.
Router
.
invoked
=
True
receiversGiver
=
None
G
.
Router
.
isCalled
.
signal
(
now
())
receiver
=
None
return
True
return
False
else
:
receiver
=
activeObject
.
selectReceiver
(
possibleReceivers
)
return
False
receiversGiver
=
activeObject
except
:
#------------------------------------------------------------------------------
return
False
# TODO: if the receiver is already assigned an operator then the giver should sort for that manager
from
Globals
import
G
for
operator
in
G
.
OperatorsList
:
if
operator
.
isAssignedTo
()
==
receiver
:
activeObject
.
sortEntitiesForOperator
(
operator
)
break
#------------------------------------------------------------------------------
# if an operator is not assigned to the receiver then do not signal the receiver but the Router
# TODO: identifyEntityToGet needs giver defined but here is not yet defined for Machines and machineJobShops
try
:
if
receiver
.
identifyEntityToGet
().
manager
:
if
any
(
type
==
'Load'
or
type
==
'Setup'
for
type
in
receiver
.
multOperationTypeList
):
if
receiver
.
identifyEntityToGet
().
manager
.
isAssignedTo
()
!=
receiver
:
from
Globals
import
G
if
not
G
.
Router
.
invoked
:
#===================================================================
# # TESTING
# print now(), self.id,' '*50, 'signalling router'
#===================================================================
G
.
Router
.
invoked
=
True
G
.
Router
.
isCalled
.
signal
(
now
())
return
False
except
:
pass
activeObject
.
receiver
=
receiver
activeObject
.
receiver
.
giver
=
activeObject
#===================================================================
# # # TESTING
# print now(), self.id,' '*50, 'signalling receiver', self.receiver.id
#===================================================================
# assign the entry of the receiver
activeObject
.
receiver
.
assignEntryTo
()
activeObject
.
receiver
.
isRequested
.
signal
(
activeObject
)
return
True
return
False
# =======================================================================
# =======================================================================
# override the default method so that Entities
# override the default method so that Entities
# that have the manager available go in front
# that have the manager available go in front
...
@@ -195,4 +158,16 @@ class QueueManagedJob(QueueJobShop):
...
@@ -195,4 +158,16 @@ class QueueManagedJob(QueueJobShop):
activeObjectQueue
.
sort
(
key
=
lambda
x
:
x
.
manager
==
operator
and
x
.
managerAvailable
,
reverse
=
True
)
activeObjectQueue
.
sort
(
key
=
lambda
x
:
x
.
manager
==
operator
and
x
.
managerAvailable
,
reverse
=
True
)
else
:
else
:
# added for testing
# added for testing
print
'there must be a caller defined for this kind of Queue sorting'
print
'there must be a caller defined for this kind of Queue sorting'
\ No newline at end of file
#===========================================================================
# sort the entities of the queue for the receiver
#===========================================================================
def
sortEntitiesForReceiver
(
self
,
receiver
=
None
):
# TODO: if the receiver is already assigned an operator then the giver should sort for that manager
activeObject
=
self
.
getActiveObject
()
from
Globals
import
G
for
operator
in
G
.
OperatorsList
:
if
operator
.
isAssignedTo
()
==
receiver
:
activeObject
.
sortEntitiesForOperator
(
operator
)
break
\ No newline at end of file
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