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
2e9e212c
Commit
2e9e212c
authored
Apr 28, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
canAcceptAndIsRequested, readLoadTime, assignExitTo, and checkOperator methods now require caller
parent
89541c19
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
67 additions
and
59 deletions
+67
-59
dream/simulation/BatchDecomposition.py
dream/simulation/BatchDecomposition.py
+5
-4
dream/simulation/BatchReassembly.py
dream/simulation/BatchReassembly.py
+5
-3
dream/simulation/Exit.py
dream/simulation/Exit.py
+4
-2
dream/simulation/LineClearance.py
dream/simulation/LineClearance.py
+5
-3
dream/simulation/Machine.py
dream/simulation/Machine.py
+7
-4
dream/simulation/MachineJobShop.py
dream/simulation/MachineJobShop.py
+11
-7
dream/simulation/MachineManagedJob.py
dream/simulation/MachineManagedJob.py
+14
-10
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+2
-18
dream/simulation/OrderDecomposition.py
dream/simulation/OrderDecomposition.py
+4
-2
dream/simulation/Queue.py
dream/simulation/Queue.py
+5
-3
dream/simulation/QueueJobShop.py
dream/simulation/QueueJobShop.py
+5
-3
No files found.
dream/simulation/BatchDecomposition.py
View file @
2e9e212c
...
...
@@ -219,12 +219,13 @@ class BatchDecomposition(CoreObject):
(
thecaller
in
activeObject
.
next
)
and
activeObjectQueue
[
0
].
type
!=
"Batch"
and
activeObject
.
Up
# =======================================================================
# canAcceptAndIsRequested logc
# canAcceptAndIsRequested log
i
c
# =======================================================================
def
canAcceptAndIsRequested
(
self
):
def
canAcceptAndIsRequested
(
self
,
callerObject
=
None
):
# get the active and the giver objects
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
self
.
getGiverObject
()
# giverObject=self.getGiverObject()
giverObject
=
callerObject
assert
giverObject
,
'there must be a caller for canAcceptAndIsRequested'
return
activeObject
.
Up
and
len
(
activeObjectQueue
)
==
0
and
giverObject
.
haveToDispose
(
activeObject
)
dream/simulation/BatchReassembly.py
View file @
2e9e212c
...
...
@@ -222,12 +222,14 @@ class BatchReassembly(CoreObject):
# which is of the same batchId as the ones that the assembler currently holds
# (if it holds any), and if doesn't hold any entities of type Batch
# =======================================================================
def
canAcceptAndIsRequested
(
self
):
def
canAcceptAndIsRequested
(
self
,
callerObject
=
None
):
# get the active and the giver objects
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
self
.
getGiverObject
()
giverObjectQueue
=
self
.
getGiverObjectQueue
()
# giverObject=self.getGiverObject()
giverObject
=
callerObject
assert
giverObject
,
'there must be a caller for canAcceptAndIsRequested'
giverObjectQueue
=
giverObject
.
getActiveObjectQueue
()
if
(
len
(
activeObjectQueue
)
==
0
):
return
activeObject
.
Up
and
giverObject
.
haveToDispose
(
activeObject
)
...
...
dream/simulation/Exit.py
View file @
2e9e212c
...
...
@@ -87,11 +87,13 @@ class Exit(CoreObject):
# checks if the Exit can accept an entity
# and there is an entity waiting for it
# =======================================================================
def
canAcceptAndIsRequested
(
self
):
def
canAcceptAndIsRequested
(
self
,
callerObject
=
None
):
# get the active object and its internal queue
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
activeObject
.
getGiverObject
()
# giverObject=activeObject.getGiverObject()
giverObject
=
callerObject
assert
giverObject
,
'there must be a caller for canAcceptAndIsRequested'
return
giverObject
.
haveToDispose
(
self
)
# =======================================================================
...
...
dream/simulation/LineClearance.py
View file @
2e9e212c
...
...
@@ -80,12 +80,14 @@ class LineClearance(Queue):
and
giverObjectQueue
[
0
].
type
==
'SubBatch'
\
and
giverObjectQueue
[
0
].
batchId
==
activeObjectQueue
[
0
].
batchId
def
canAcceptAndIsRequested
(
self
):
def
canAcceptAndIsRequested
(
self
,
callerObject
=
None
):
# get the active and the giver objects
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
self
.
getGiverObject
()
giverObjectQueue
=
self
.
getGiverObjectQueue
()
# giverObject=self.getGiverObject()
giverObject
=
callerObject
assert
giverObject
,
'there must be a caller for canAcceptAndIsRequested'
giverObjectQueue
=
giverObject
.
getActiveObjectQueue
()
#if we have only one potential giver just check if there is a place available and the potential giver has an entity to dispose
if
(
len
(
activeObject
.
previous
)
==
1
):
...
...
dream/simulation/Machine.py
View file @
2e9e212c
...
...
@@ -224,6 +224,7 @@ class Machine(CoreObject):
while
1
:
# waitEvent isRequested /interruptionEnd/loadOperatorAvailable
while
1
:
# print now(), self.id, 'will wait for event'
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
interruptionEnd
,
self
.
loadOperatorAvailable
]
# print now(), self.id, 'received an event'
# if the machine can accept an entity and one predecessor requests it continue with receiving the entity
...
...
@@ -646,11 +647,13 @@ class Machine(CoreObject):
# some possible giver waiting for it
# also updates the giver to the one that is to be taken
# =======================================================================
def
canAcceptAndIsRequested
(
self
):
def
canAcceptAndIsRequested
(
self
,
callerObject
=
None
):
# get active and giver objects
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
self
.
getGiverObject
()
# giverObject=self.getGiverObject()
giverObject
=
callerObject
assert
giverObject
,
'there must be a caller for canAcceptAndIsRequested'
# check if there is a place, the machine is up and the predecessor has an entity to dispose. if the machine has to compete
# for an Operator that loads the entities onto it check if the predecessor if blocked by an other Machine. if not then the machine
# has to block the predecessor giverObject to avoid conflicts with other competing machines
...
...
@@ -668,7 +671,7 @@ class Machine(CoreObject):
if
activeObject
.
operatorPool
.
checkIfResourceIsAvailable
()
\
and
activeObject
.
checkIfActive
()
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
:
if
not
giverObject
.
exitIsAssignedTo
():
activeObject
.
giver
.
assignExitTo
(
)
giverObject
.
assignExitTo
(
activeObject
)
elif
giverObject
.
exitIsAssignedTo
()
!=
activeObject
:
return
False
# if the activeObject is not in operators' activeCallersList
...
...
@@ -686,7 +689,7 @@ class Machine(CoreObject):
if
activeObject
.
checkIfActive
()
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
\
and
giverObject
.
haveToDispose
(
activeObject
):
if
not
giverObject
.
exitIsAssignedTo
():
activeObject
.
giver
.
assignExitTo
(
)
giverObject
.
assignExitTo
(
activeObject
)
elif
giverObject
.
exitIsAssignedTo
()
!=
activeObject
:
return
False
return
True
...
...
dream/simulation/MachineJobShop.py
View file @
2e9e212c
...
...
@@ -262,12 +262,14 @@ class MachineJobShop(Machine):
# extend the default behaviour to check if whether the station
# is in the route of the entity to be received
#===========================================================================
def
canAcceptAndIsRequested
(
self
):
def
canAcceptAndIsRequested
(
self
,
callerObject
):
activeObject
=
self
.
getActiveObject
()
giverObject
=
activeObject
.
getGiverObject
()
# giverObject=activeObject.getGiverObject()
giverObject
=
callerObject
assert
giverObject
,
'there must be a caller for canAcceptAndIsRequested'
if
activeObject
.
isInRoute
(
giverObject
):
if
Machine
.
canAcceptAndIsRequested
(
self
):
activeObject
.
readLoadTime
()
if
Machine
.
canAcceptAndIsRequested
(
self
,
giverObject
):
activeObject
.
readLoadTime
(
giverObject
)
return
True
return
False
...
...
@@ -275,10 +277,12 @@ class MachineJobShop(Machine):
# to be called by canAcceptAndIsRequested if it is to return True.
# the load timeof the Entity must be read
#===========================================================================
def
readLoadTime
(
self
):
def
readLoadTime
(
self
,
callerObject
=
None
):
assert
callerObject
!=
None
,
'the caller of readLoadTime cannot be None'
activeObject
=
self
.
getActiveObject
()
activeObject
.
giver
.
sortEntities
()
activeEntity
=
activeObject
.
giver
.
getActiveObjectQueue
()[
0
]
thecaller
=
callerObject
thecaller
.
sortEntities
()
activeEntity
=
thecaller
.
getActiveObjectQueue
()[
0
]
loadTime
=
activeEntity
.
remainingRoute
[
0
].
get
(
'loadTime'
,{})
activeObject
.
distType
=
loadTime
.
get
(
'distributionType'
,
'Fixed'
)
activeObject
.
loadTime
=
float
(
loadTime
.
get
(
'mean'
,
0
))
...
...
dream/simulation/MachineManagedJob.py
View file @
2e9e212c
...
...
@@ -103,11 +103,13 @@ class MachineManagedJob(MachineJobShop):
# some possible giver waiting for it
# also updates the giver to the one that is to be taken
# =======================================================================
def
canAcceptAndIsRequested
(
self
):
def
canAcceptAndIsRequested
(
self
,
callerObject
=
None
):
# get active and giver objects
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
activeObject
.
getGiverObject
()
# giverObject=activeObject.getGiverObject()
giverObject
=
callerObject
assert
giverObject
,
'there must be a caller for canAcceptAndIsRequested'
giverObjectQueue
=
giverObject
.
getActiveObjectQueue
()
# if the multOperationTypeList of the machine contains Load or Setup
if
(
activeObject
.
operatorPool
!=
'None'
and
(
any
(
type
==
'Load'
for
type
in
activeObject
.
multOperationTypeList
)
\
...
...
@@ -123,10 +125,10 @@ class MachineManagedJob(MachineJobShop):
# activeObject.operatorPool.receivingObject=activeObject
#===============================================================
if
activeObject
.
checkIfActive
()
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
\
and
activeObject
.
checkOperator
():
and
activeObject
.
checkOperator
(
giverObject
):
if
not
giverObject
.
exitIsAssignedTo
():
# print self.id, 'assigning givers exit'
giverObject
.
assignExitTo
()
giverObject
.
assignExitTo
(
activeObject
)
elif
giverObject
.
exitIsAssignedTo
()
!=
activeObject
:
return
False
# if the activeObject is not in manager's activeCallersList of the entityToGet
...
...
@@ -138,7 +140,7 @@ class MachineManagedJob(MachineJobShop):
#make the operators List so that it holds only the manager of the current order
activeObject
.
operatorPool
.
operators
=
[
giverObjectQueue
[
0
].
manager
]
# read the load time of the machine
activeObject
.
readLoadTime
()
activeObject
.
readLoadTime
(
giverObject
)
return
True
else
:
return
False
...
...
@@ -176,7 +178,7 @@ class MachineManagedJob(MachineJobShop):
#make the operators List so that it holds only the manager of the current order
activeObject
.
operatorPool
.
operators
=
[
giverObjectQueue
[
0
].
manager
]
# read the load time of the machine
activeObject
.
readLoadTime
()
activeObject
.
readLoadTime
(
giverObject
)
return
True
else
:
return
False
...
...
@@ -185,16 +187,18 @@ class MachineManagedJob(MachineJobShop):
# is not assigned to operators
if
activeObject
.
checkIfActive
()
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
and
giverObject
.
haveToDispose
(
activeObject
):
# update entityToGet
activeObject
.
entityToGet
=
self
.
giver
.
getActiveObjectQueue
()[
0
]
activeObject
.
readLoadTime
()
activeObject
.
entityToGet
=
giverObject
.
getActiveObjectQueue
()[
0
]
activeObject
.
readLoadTime
(
giverObject
)
return
activeObject
.
checkIfActive
()
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
and
giverObject
.
haveToDispose
(
activeObject
)
# =======================================================================
# to be called by canAcceptAndIsRequested and check for the operator
# =======================================================================
def
checkOperator
(
self
):
#, candidateEntity=None):
def
checkOperator
(
self
,
callerObject
=
None
):
#, candidateEntity=None):
assert
callerObject
!=
None
,
'checkOperator must have a caller for MachineManagedJob'
activeObject
=
self
.
getActiveObject
()
giverObject
=
activeObject
.
getGiverObject
()
# giverObject=activeObject.getGiverObject()
giverObject
=
callerObject
giverObjectQueue
=
giverObject
.
getActiveObjectQueue
()
if
giverObjectQueue
[
0
].
manager
:
manager
=
giverObjectQueue
[
0
].
manager
...
...
dream/simulation/OperatedPoolBroker.py
View file @
2e9e212c
...
...
@@ -75,6 +75,7 @@ class Broker(ObjectInterruption):
if
self
.
victim
.
isOperated
()
\
and
any
(
type
==
'Load'
or
type
==
'Setup'
or
type
==
'Processing'
\
for
type
in
self
.
victim
.
multOperationTypeList
):
# print now(), self.victim.id, 'broker is invoked'
# update the time that the station is waiting for the operator
self
.
timeWaitForOperatorStarted
=
now
()
# if the resource is not available wait until a rousourceAvailable event
...
...
@@ -252,28 +253,11 @@ class Broker(ObjectInterruption):
# # TESTING
# print now(), self.victim.id, 'broker signalling ', machine.id, 'loadOperatorAvailable2'
#===============================================
#
machine.loadOperatorAvailable.signal(now())
machine
.
loadOperatorAvailable
.
signal
(
now
())
# print 'machines waitingForLoadOperator',[str(x.id) for x in loadPendingMachines]
# print 'machines waitingForOperator',[str(x.id) for x in candidateMachines]
# # for the candidateMachines
# if loadPendingMachines:
# maxTimeWaiting=0
# receiver=None
# # choose the one that waits the most time and give it the chance to grasp the resource
# # TODO: failures after the end of processing are not considered here
# for machine in loadPendingMachines:
# timeWaiting=now()-machine.timeLastEntityEnded
# if(timeWaiting>maxTimeWaiting or maxTimeWaiting==0):
# maxTimeWaiting=timeWaiting
# receiver=machine
# #===============================================
# # # TESTING
# # print now(), self.victim.id, 'broker signalling', machine.id, 'loadOperatorAvailable'
# #===============================================
# # finally signal the machine to receive the operator
# receiver.loadOperatorAvailable.signal(now())
# for the candidateMachines
if
candidateMachines
:
...
...
dream/simulation/OrderDecomposition.py
View file @
2e9e212c
...
...
@@ -106,11 +106,13 @@ class OrderDecomposition(CoreObject):
# and there is an entity in some possible giver waiting for it
# also updates the giver to the one that is to be taken
# =======================================================================
def
canAcceptAndIsRequested
(
self
):
def
canAcceptAndIsRequested
(
self
,
callerObject
=
None
):
# get active and giver objects
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
self
.
getGiverObject
()
# giverObject=self.getGiverObject()
giverObject
=
callerObject
assert
giverObject
,
'there must be a caller for canAcceptAndIsRequested'
# if we have only one possible giver just check if there is a place,
# the machine is up and the predecessor has an entity to dispose
# this is done to achieve better (cpu) processing time
...
...
dream/simulation/Queue.py
View file @
2e9e212c
...
...
@@ -106,7 +106,7 @@ class Queue(CoreObject):
activeObjectQueue
[
0
].
startTime
=
now
()
# if the queue received an canDispose with signalparam time, this means that the signals was sent from a MouldAssemblyBuffer
if
self
.
canDispose
.
signalparam
:
# print now(), self.id, 'received a canDispose event
from', self.canDispose.signalparam
# print now(), self.id, 'received a canDispose event
'
self
.
canDispose
.
signalparam
=
None
# if the event that activated the thread is canDispose then signalReceiver
if
self
.
haveToDispose
():
...
...
@@ -173,11 +173,13 @@ class Queue(CoreObject):
# there is an entity in some predecessor waiting for it
# also updates the predecessorIndex to the one that is to be taken
# =======================================================================
def
canAcceptAndIsRequested
(
self
):
def
canAcceptAndIsRequested
(
self
,
callerObject
=
None
):
# get the active and the giver objects
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
self
.
getGiverObject
()
# giverObject=self.getGiverObject()
giverObject
=
callerObject
assert
giverObject
,
'there must be a caller for canAcceptAndIsRequested'
return
len
(
activeObjectQueue
)
<
activeObject
.
capacity
and
giverObject
.
haveToDispose
(
activeObject
)
...
...
dream/simulation/QueueJobShop.py
View file @
2e9e212c
...
...
@@ -100,11 +100,13 @@ class QueueJobShop(Queue):
# extend the default behaviour to check if whether the station
# is in the route of the entity to be received
#===========================================================================
def
canAcceptAndIsRequested
(
self
):
def
canAcceptAndIsRequested
(
self
,
callerObject
=
None
):
activeObject
=
self
.
getActiveObject
()
giverObject
=
activeObject
.
getGiverObject
()
# giverObject=activeObject.getGiverObject()
giverObject
=
callerObject
assert
giverObject
,
'there must be a caller for canAcceptAndIsRequested'
if
activeObject
.
isInRoute
(
giverObject
):
return
Queue
.
canAcceptAndIsRequested
(
self
)
return
Queue
.
canAcceptAndIsRequested
(
self
,
giverObject
)
# =======================================================================
# gets an entity from the predecessor that the predecessor index points to
...
...
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