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
Show 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):
return
False
receiver
=
activeObject
.
selectReceiver
(
possibleReceivers
)
receiversGiver
=
activeObject
#------------------------------------------------------------------------------
# if an operator is not assigned to the receiver then do not signal the receiver but the Router
try
:
if
not
receiver
.
assignedOperator
:
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
())
# sorting the entities of the object for the receiver
activeObject
.
sortEntitiesForReceiver
(
receiver
)
# signalling the Router if the receiver is operated and not assigned an operator
if
activeObject
.
signalRouter
(
receiver
):
return
False
except
:
pass
#------------------------------------------------------------------------------
activeObject
.
receiver
=
receiver
activeObject
.
receiver
.
giver
=
activeObject
...
...
@@ -395,6 +382,34 @@ class CoreObject(Process):
receiver
=
object
# set the receiver as the longest waiting possible 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
#===========================================================================
...
...
dream/simulation/Machine.py
View file @
10fa0a8c
...
...
@@ -689,6 +689,13 @@ class Machine(CoreObject):
return
False
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
# =======================================================================
...
...
dream/simulation/QueueManagedJob.py
View file @
10fa0a8c
...
...
@@ -101,67 +101,30 @@ class QueueManagedJob(QueueJobShop):
# and (thecaller in activeObject.next)\
# and thecaller.isInRoute(activeObject)
#===========================================================================
#
signalReceiver M
ethod
#
signalRouter m
ethod
#===========================================================================
def
signalReceiver
(
self
):
# print now(), self.id, 'trying to signal receiver'
activeObject
=
self
.
getActiveObject
()
possibleReceivers
=
[]
for
object
in
[
x
for
x
in
self
.
next
if
x
.
canAccept
(
activeObject
)]:
possibleReceivers
.
append
(
object
)
if
possibleReceivers
:
receiver
=
activeObject
.
selectReceiver
(
possibleReceivers
)
receiversGiver
=
activeObject
# perform the checks that canAcceptAndIsRequested used to perform and update assignExit and operatorPool
while
not
receiver
.
canAcceptAndIsRequested
(
receiversGiver
):
# print 'removing receiver from possibleReceivrs', receiver.id
possibleReceivers
.
remove
(
receiver
)
if
not
possibleReceivers
:
receiversGiver
=
None
receiver
=
None
return
False
receiver
=
activeObject
.
selectReceiver
(
possibleReceivers
)
receiversGiver
=
activeObject
#------------------------------------------------------------------------------
# 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
#------------------------------------------------------------------------------
def
signalRouter
(
self
,
receiver
=
None
):
# 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
.
isLoadRequested
(
):
if
receiver
.
identifyEntityToGet
().
manager
.
isAssignedTo
()
!=
receiver
:
from
Globals
import
G
if
not
G
.
Router
.
invoked
:
#===================================================================
# # TESTING
# # TESTING
# print now(), self.id,' '*50, 'signalling router'
#===================================================================
G
.
Router
.
invoked
=
True
G
.
Router
.
isCalled
.
signal
(
now
())
return
True
else
:
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
# that have the manager available go in front
...
...
@@ -196,3 +159,15 @@ class QueueManagedJob(QueueJobShop):
else
:
# added for testing
print
'there must be a caller defined for this kind of Queue sorting'
#===========================================================================
# 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