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
2934e764
Commit
2934e764
authored
May 23, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new printTrace method
parent
f82e0286
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
162 additions
and
61 deletions
+162
-61
dream/simulation/Assembly.py
dream/simulation/Assembly.py
+16
-8
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+25
-12
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+71
-5
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+6
-3
dream/simulation/Machine.py
dream/simulation/Machine.py
+16
-8
dream/simulation/MachineJobShop.py
dream/simulation/MachineJobShop.py
+4
-2
dream/simulation/MachineManagedJob.py
dream/simulation/MachineManagedJob.py
+0
-13
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+10
-4
dream/simulation/Queue.py
dream/simulation/Queue.py
+12
-5
dream/simulation/QueueManagedJob.py
dream/simulation/QueueManagedJob.py
+2
-1
No files found.
dream/simulation/Assembly.py
View file @
2934e764
...
@@ -123,22 +123,26 @@ class Assembly(CoreObject):
...
@@ -123,22 +123,26 @@ class Assembly(CoreObject):
# check if there is WIP and signal receiver
# check if there is WIP and signal receiver
self
.
initialSignalReceiver
()
self
.
initialSignalReceiver
()
while
1
:
while
1
:
self
.
printTrace
(
self
.
id
,
'will wait for frame event'
)
# self.printTrace(self.id, 'will wait for frame event')
self
.
printTrace1
(
self
.
id
,
waitEvent
=
''
)
# wait until the Queue can accept an entity and one predecessor requests it
# wait until the Queue can accept an entity and one predecessor requests it
yield
waitevent
,
self
,
self
.
isRequested
#[self.isRequested,self.canDispose, self.loadOperatorAvailable]
yield
waitevent
,
self
,
self
.
isRequested
#[self.isRequested,self.canDispose, self.loadOperatorAvailable]
if
self
.
isRequested
.
signalparam
:
if
self
.
isRequested
.
signalparam
:
self
.
printTrace
(
self
.
id
,
'received a isRequested event from '
+
self
.
isRequested
.
signalparam
.
id
)
# self.printTrace(self.id, 'received a isRequested event from '+self.isRequested.signalparam.id)
self
.
printTrace1
(
self
.
id
,
isRequested
=
self
.
isRequested
.
signalparam
.
id
)
# reset the isRequested signal parameter
# reset the isRequested signal parameter
self
.
isRequested
.
signalparam
=
None
self
.
isRequested
.
signalparam
=
None
self
.
getEntity
(
"Frame"
)
#get the Frame
self
.
getEntity
(
"Frame"
)
#get the Frame
for
i
in
range
(
self
.
getActiveObjectQueue
()[
0
].
capacity
):
#this loop will be carried until the Frame is full with the parts
for
i
in
range
(
self
.
getActiveObjectQueue
()[
0
].
capacity
):
#this loop will be carried until the Frame is full with the parts
self
.
printTrace
(
self
.
id
,
'will wait for part event'
)
self
.
printTrace1
(
self
.
id
,
waitEvent
=
'(to load parts)'
)
# self.printTrace(self.id, 'will wait for part event')
yield
waitevent
,
self
,
self
.
isRequested
yield
waitevent
,
self
,
self
.
isRequested
if
self
.
isRequested
.
signalparam
:
if
self
.
isRequested
.
signalparam
:
self
.
printTrace
(
self
.
id
,
'received a isRequested event from '
+
self
.
isRequested
.
signalparam
.
id
)
# self.printTrace(self.id, 'received a isRequested event from '+self.isRequested.signalparam.id)
self
.
printTrace1
(
self
.
id
,
isRequested
=
self
.
isRequested
.
signalparam
.
id
)
# reset the isRequested signal parameter
# reset the isRequested signal parameter
self
.
isRequested
.
signalparam
=
None
self
.
isRequested
.
signalparam
=
None
# TODO: fix the getEntity 'Part' case
# TODO: fix the getEntity 'Part' case
...
@@ -162,7 +166,8 @@ class Assembly(CoreObject):
...
@@ -162,7 +166,8 @@ class Assembly(CoreObject):
self
.
completedJobs
+=
1
#Assembly completed a job
self
.
completedJobs
+=
1
#Assembly completed a job
self
.
waitToDispose
=
True
#since all the frame is full
self
.
waitToDispose
=
True
#since all the frame is full
self
.
printTrace
(
self
.
id
,
'will try to signal a receiver from generator'
)
# self.printTrace(self.id, 'will try to signal a receiver from generator')
self
.
printTrace1
(
self
.
id
,
attemptSignalReceiver
=
'(generator'
)
# signal the receiver that the activeObject has something to dispose of
# signal the receiver that the activeObject has something to dispose of
if
not
self
.
signalReceiver
():
if
not
self
.
signalReceiver
():
# if there was no available receiver, get into blocking control
# if there was no available receiver, get into blocking control
...
@@ -245,7 +250,8 @@ class Assembly(CoreObject):
...
@@ -245,7 +250,8 @@ class Assembly(CoreObject):
activeEntity
=
CoreObject
.
removeEntity
(
self
,
entity
)
#run the default method
activeEntity
=
CoreObject
.
removeEntity
(
self
,
entity
)
#run the default method
self
.
waitToDispose
=
False
self
.
waitToDispose
=
False
if
self
.
canAccept
():
if
self
.
canAccept
():
self
.
printTrace
(
self
.
id
,
'will try signalling a giver from removeEntity'
)
# self.printTrace(self.id, 'will try signalling a giver from removeEntity')
self
.
printTrace1
(
self
.
id
,
attemptSignalGiver
=
'(removeEntity)'
)
self
.
signalGiver
()
self
.
signalGiver
()
return
activeEntity
return
activeEntity
...
@@ -270,7 +276,8 @@ class Assembly(CoreObject):
...
@@ -270,7 +276,8 @@ class Assembly(CoreObject):
assert
activeEntity
.
type
==
type
,
'the type of the entity to get must be of type '
+
type
+
' while it is '
+
activeEntity
.
type
assert
activeEntity
.
type
==
type
,
'the type of the entity to get must be of type '
+
type
+
' while it is '
+
activeEntity
.
type
#remove the entity from the previews object
#remove the entity from the previews object
giverObject
.
removeEntity
(
activeEntity
)
giverObject
.
removeEntity
(
activeEntity
)
self
.
printTrace
(
activeEntity
.
name
,
"got into "
+
self
.
id
)
# self.printTrace(activeEntity.name, "got into "+self.id)
self
.
printTrace1
(
activeEntity
.
name
,
enter
=
self
.
id
)
self
.
outputTrace
(
activeEntity
.
name
,
"got into "
+
self
.
objName
)
self
.
outputTrace
(
activeEntity
.
name
,
"got into "
+
self
.
objName
)
# if the type is Frame
# if the type is Frame
if
(
activeEntity
.
type
==
"Frame"
):
if
(
activeEntity
.
type
==
"Frame"
):
...
@@ -280,7 +287,8 @@ class Assembly(CoreObject):
...
@@ -280,7 +287,8 @@ class Assembly(CoreObject):
# if the frame is not fully loaded then signal a giver
# if the frame is not fully loaded then signal a giver
if
len
(
activeObjectQueue
[
0
].
getFrameQueue
())
<
activeObjectQueue
[
0
].
capacity
:
if
len
(
activeObjectQueue
[
0
].
getFrameQueue
())
<
activeObjectQueue
[
0
].
capacity
:
self
.
printTrace
(
self
.
id
,
'will try signalling a giver from getEntity'
)
# self.printTrace(self.id, 'will try signalling a giver from getEntity')
self
.
printTrace1
(
self
.
id
,
attemptSignalGiver
=
'(getEntity)'
)
self
.
signalGiver
()
self
.
signalGiver
()
return
activeEntity
return
activeEntity
...
...
dream/simulation/Conveyer.py
View file @
2934e764
...
@@ -100,11 +100,13 @@ class Conveyer(CoreObject):
...
@@ -100,11 +100,13 @@ class Conveyer(CoreObject):
# print self.id, 'time to move', self.conveyerMover.timeToWait
# print self.id, 'time to move', self.conveyerMover.timeToWait
self
.
conveyerMover
.
canMove
.
signal
(
now
())
self
.
conveyerMover
.
canMove
.
signal
(
now
())
self
.
printTrace
(
self
.
id
,
'will wait for event'
)
# self.printTrace(self.id, 'will wait for event')
self
.
printTrace1
(
self
.
id
,
waitEvent
=
''
)
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
canDispose
,
self
.
moveEnd
]
# , self.loadOperatorAvailable]
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
canDispose
,
self
.
moveEnd
]
# , self.loadOperatorAvailable]
# if the event that activated the thread is isRequested then getEntity
# if the event that activated the thread is isRequested then getEntity
if
self
.
isRequested
.
signalparam
:
if
self
.
isRequested
.
signalparam
:
self
.
printTrace
(
self
.
id
,
'received an is requested event'
)
# self.printTrace(self.id, 'received an is requested event')
self
.
printTrace1
(
self
.
id
,
isRequested
=
''
)
# reset the isRequested signal parameter
# reset the isRequested signal parameter
self
.
isRequested
.
signalparam
=
None
self
.
isRequested
.
signalparam
=
None
# get the entity
# get the entity
...
@@ -117,26 +119,32 @@ class Conveyer(CoreObject):
...
@@ -117,26 +119,32 @@ class Conveyer(CoreObject):
# self.loadOperatorAvailable.signalparam=None
# self.loadOperatorAvailable.signalparam=None
# if the queue received an canDispose with signalparam time, this means that the signals was sent from a MouldAssemblyBuffer
# if the queue received an canDispose with signalparam time, this means that the signals was sent from a MouldAssemblyBuffer
if
self
.
canDispose
.
signalparam
:
if
self
.
canDispose
.
signalparam
:
self
.
printTrace
(
self
.
id
,
'received a canDispose event'
)
# self.printTrace(self.id, 'received a canDispose event')
self
.
printTrace1
(
self
.
id
,
canDispose
=
''
)
self
.
canDispose
.
signalparam
=
None
self
.
canDispose
.
signalparam
=
None
# if the object received a moveEnd signal from the ConveyerMover
# if the object received a moveEnd signal from the ConveyerMover
if
self
.
moveEnd
.
signalparam
:
if
self
.
moveEnd
.
signalparam
:
self
.
printTrace
(
self
.
id
,
'received a moveEnd event'
)
# self.printTrace(self.id, 'received a moveEnd event')
self
.
printTrace1
(
self
.
id
,
moveEnd
=
''
)
self
.
moveEnd
.
signalparam
=
None
self
.
moveEnd
.
signalparam
=
None
# check if there is a possibility to accept and signal a giver
# check if there is a possibility to accept and signal a giver
if
self
.
canAccept
():
if
self
.
canAccept
():
self
.
printTrace
(
self
.
id
,
'will try to signal Giver from removeEntity'
)
# self.printTrace(self.id, 'will try to signal Giver from removeEntity')
self
.
printTrace
(
self
.
id
,
attemptSignalGiver
=
'(removeEntity)'
)
self
.
signalGiver
()
self
.
signalGiver
()
# if the event that activated the thread is canDispose then signalReceiver
# if the event that activated the thread is canDispose then signalReceiver
if
self
.
haveToDispose
():
if
self
.
haveToDispose
():
# self.printTrace(self.id, 'will try to signal a receiver from generator')
# self.printTrace(self.id, 'will try to signal a receiver from generator')
self
.
printTrace1
(
self
.
id
,
attemptSignalReceiver
=
'(generator)'
)
if
self
.
receiver
:
if
self
.
receiver
:
if
not
self
.
receiver
.
entryIsAssignedTo
():
if
not
self
.
receiver
.
entryIsAssignedTo
():
self
.
printTrace
(
self
.
id
,
'will try to signal receiver from generator1'
)
# self.printTrace(self.id, 'will try to signal receiver from generator1')
self
.
printTrace1
(
self
.
id
,
attemptSignalReceiver
=
'(generator1)'
)
self
.
signalReceiver
()
self
.
signalReceiver
()
continue
continue
self
.
printTrace
(
self
.
id
,
'will try to signal receiver from generator2'
)
# self.printTrace(self.id, 'will try to signal receiver from generator2')
self
.
printTrace1
(
self
.
id
,
attemptSignalReceiver
=
'(generator2)'
)
self
.
signalReceiver
()
self
.
signalReceiver
()
#===========================================================================
#===========================================================================
...
@@ -195,7 +203,8 @@ class Conveyer(CoreObject):
...
@@ -195,7 +203,8 @@ class Conveyer(CoreObject):
if
(
self
.
length
-
self
.
position
[
0
]
<
0.000001
)
and
(
not
self
.
entityLastReachedEnd
==
self
.
getActiveObjectQueue
()[
0
]):
if
(
self
.
length
-
self
.
position
[
0
]
<
0.000001
)
and
(
not
self
.
entityLastReachedEnd
==
self
.
getActiveObjectQueue
()[
0
]):
self
.
waitToDispose
=
True
self
.
waitToDispose
=
True
self
.
entityLastReachedEnd
=
self
.
getActiveObjectQueue
()[
0
]
self
.
entityLastReachedEnd
=
self
.
getActiveObjectQueue
()[
0
]
self
.
printTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
'has reached the end'
+
' !! . !! .'
*
7
)
# self.printTrace(self.getActiveObjectQueue()[0].name, 'has reached the end'+' !! . !! .'*7)
self
.
printTrace1
(
self
.
getActiveObjectQueue
()[
0
].
name
,
conveyerEnd
=
''
)
return
True
return
True
return
False
return
False
...
@@ -334,7 +343,8 @@ class Conveyer(CoreObject):
...
@@ -334,7 +343,8 @@ class Conveyer(CoreObject):
if
self
.
isFull
():
if
self
.
isFull
():
self
.
timeBlockageStarted
=
now
()
self
.
timeBlockageStarted
=
now
()
self
.
wasFull
=
True
self
.
wasFull
=
True
self
.
printTrace
(
self
.
id
,
'is now Full '
+
str
(
len
(
self
.
getActiveObjectQueue
()))
+
' (*) '
*
20
)
# self.printTrace(self.id, 'is now Full '+str(len(self.getActiveObjectQueue()))+' (*) '*20)
self
.
printTrace1
(
self
.
id
,
conveyerFull
=
str
(
len
(
self
.
getActiveObjectQueue
())))
return
activeEntity
return
activeEntity
#===========================================================================
#===========================================================================
...
@@ -357,7 +367,8 @@ class Conveyer(CoreObject):
...
@@ -357,7 +367,8 @@ class Conveyer(CoreObject):
self
.
conveyerMover
.
canMove
.
signal
(
now
())
self
.
conveyerMover
.
canMove
.
signal
(
now
())
# if there is anything to dispose of then signal a receiver
# if there is anything to dispose of then signal a receiver
if
self
.
haveToDispose
():
if
self
.
haveToDispose
():
self
.
printTrace
(
self
.
id
,
'will try to signal a receiver from removeEntity'
)
# self.printTrace(self.id, 'will try to signal a receiver from removeEntity')
self
.
printTrace1
(
self
.
id
,
attemptSingalReceiver
=
'(removeEntity)'
)
self
.
signalReceiver
()
self
.
signalReceiver
()
return
activeEntity
return
activeEntity
...
@@ -510,9 +521,11 @@ class ConveyerMover(Process):
...
@@ -510,9 +521,11 @@ class ConveyerMover(Process):
#===========================================================================
#===========================================================================
def
run
(
self
):
def
run
(
self
):
while
1
:
while
1
:
self
.
conveyer
.
printTrace
(
self
.
conveyer
.
id
,
'mover will wait for canMove event'
)
# self.conveyer.printTrace(self.conveyer.id, 'mover will wait for canMove event')
self
.
conveyer
.
printTrace1
(
self
.
conveyer
.
id
,
waitEvent
=
'(canMove)'
)
yield
waitevent
,
self
,
self
.
canMove
#wait until the conveyer triggers the mover
yield
waitevent
,
self
,
self
.
canMove
#wait until the conveyer triggers the mover
self
.
conveyer
.
printTrace
(
self
.
conveyer
.
id
,
'mover received canMove event'
)
# self.conveyer.printTrace(self.conveyer.id, 'mover received canMove event')
self
.
conveyer
.
printTrace1
(
self
.
conveyer
.
id
,
received
=
'(canMove)'
)
yield
hold
,
self
,
self
.
timeToWait
#wait for the time that the conveyer calculated
yield
hold
,
self
,
self
.
timeToWait
#wait for the time that the conveyer calculated
# print '. .'*40
# print '. .'*40
...
...
dream/simulation/CoreObject.py
View file @
2934e764
...
@@ -248,7 +248,8 @@ class CoreObject(Process):
...
@@ -248,7 +248,8 @@ class CoreObject(Process):
# update the next list of the object
# update the next list of the object
activeObject
.
updateNext
(
activeEntity
)
activeObject
.
updateNext
(
activeEntity
)
self
.
outputTrace
(
activeEntity
.
name
,
"got into "
+
self
.
objName
)
self
.
outputTrace
(
activeEntity
.
name
,
"got into "
+
self
.
objName
)
self
.
printTrace
(
activeEntity
.
name
,
"got into "
+
self
.
id
)
# self.printTrace(activeEntity.name, "got into "+self.id)
self
.
printTrace1
(
activeEntity
.
name
,
enter
=
self
.
id
)
return
activeEntity
return
activeEntity
#===========================================================================
#===========================================================================
...
@@ -299,7 +300,8 @@ class CoreObject(Process):
...
@@ -299,7 +300,8 @@ class CoreObject(Process):
#if the receiver does not hold an Entity that is also critical
#if the receiver does not hold an Entity that is also critical
if
not
receiver
.
getActiveObjectQueue
()[
0
].
isCritical
:
if
not
receiver
.
getActiveObjectQueue
()[
0
].
isCritical
:
receiver
.
shouldPreempt
=
True
receiver
.
shouldPreempt
=
True
activeObject
.
printTrace
(
self
.
id
,
'preempting receiver '
+
receiver
.
id
+
'.. '
*
6
)
# activeObject.printTrace(self.id, 'preempting receiver '+receiver.id+'.. '*6)
self
.
printTrace1
(
self
.
id
,
preempt
=
receiver
.
id
)
receiver
.
preempt
()
receiver
.
preempt
()
receiver
.
timeLastEntityEnded
=
now
()
#required to count blockage correctly in the preemptied station
receiver
.
timeLastEntityEnded
=
now
()
#required to count blockage correctly in the preemptied station
# sort so that the critical entity is placed in front
# sort so that the critical entity is placed in front
...
@@ -351,7 +353,8 @@ class CoreObject(Process):
...
@@ -351,7 +353,8 @@ class CoreObject(Process):
activeObject
.
receiver
=
receiver
activeObject
.
receiver
=
receiver
activeObject
.
receiver
.
giver
=
activeObject
activeObject
.
receiver
.
giver
=
activeObject
self
.
printTrace
(
self
.
id
,
' '
*
50
+
'signalling receiver '
+
self
.
receiver
.
id
)
# self.printTrace(self.id, ' '*50+'signalling receiver '+self.receiver.id)
self
.
printTrace1
(
self
.
id
,
signalReceiver
=
self
.
receiver
.
id
)
# assign the entry of the receiver
# assign the entry of the receiver
activeObject
.
receiver
.
assignEntryTo
()
activeObject
.
receiver
.
assignEntryTo
()
activeObject
.
receiver
.
isRequested
.
signal
(
activeObject
)
activeObject
.
receiver
.
isRequested
.
signal
(
activeObject
)
...
@@ -387,7 +390,8 @@ class CoreObject(Process):
...
@@ -387,7 +390,8 @@ class CoreObject(Process):
if
receiver
.
isLoadRequested
():
if
receiver
.
isLoadRequested
():
from
Globals
import
G
from
Globals
import
G
if
not
G
.
Router
.
invoked
:
if
not
G
.
Router
.
invoked
:
self
.
printTrace
(
self
.
id
,
' '
*
50
+
'signalling router'
)
# self.printTrace(self.id, ' '*50+'signalling router')
self
.
printTrace1
(
self
.
id
,
signal
=
'router'
)
G
.
Router
.
invoked
=
True
G
.
Router
.
invoked
=
True
G
.
Router
.
isCalled
.
signal
(
now
())
G
.
Router
.
isCalled
.
signal
(
now
())
return
True
return
True
...
@@ -432,7 +436,8 @@ class CoreObject(Process):
...
@@ -432,7 +436,8 @@ class CoreObject(Process):
giversReceiver
=
activeObject
giversReceiver
=
activeObject
activeObject
.
giver
=
giver
activeObject
.
giver
=
giver
activeObject
.
giver
.
receiver
=
activeObject
activeObject
.
giver
.
receiver
=
activeObject
self
.
printTrace
(
self
.
id
,
' '
*
50
+
'signalling giver '
+
self
.
giver
.
id
)
# self.printTrace(self.id, ' '*50+'signalling giver '+self.giver.id)
self
.
printTrace1
(
self
.
id
,
signalGiver
=
self
.
giver
.
id
)
activeObject
.
giver
.
canDispose
.
signal
(
activeObject
)
activeObject
.
giver
.
canDispose
.
signal
(
activeObject
)
return
True
return
True
return
False
return
False
...
@@ -497,6 +502,67 @@ class CoreObject(Process):
...
@@ -497,6 +502,67 @@ class CoreObject(Process):
if
(
G
.
console
==
"Yes"
):
#output only if the user has selected to
if
(
G
.
console
==
"Yes"
):
#output only if the user has selected to
print
now
(),
entityName
,
message
print
now
(),
entityName
,
message
def
printTrace1
(
self
,
entity
=
''
,
**
kw
):
assert
len
(
kw
)
==
1
,
'only one phrase per printTrace supported for the moment'
from
Globals
import
G
time
=
now
()
charLimit
=
60
remainingChar
=
charLimit
-
len
(
entity
)
-
len
(
str
(
time
))
if
(
G
.
console
==
'Yes'
):
print
time
,
entity
,
for
key
in
kw
:
if
key
not
in
self
.
getSupportedPrintKwrds
():
raise
ValueError
(
"Unsupported phrase %s for %s"
%
(
key
,
self
.
id
))
element
=
self
.
getPhrase
()[
key
]
phrase
=
element
[
'phrase'
]
prefix
=
element
.
get
(
'prefix'
,
None
)
suffix
=
element
.
get
(
'suffix'
,
None
)
arg
=
kw
[
key
]
if
prefix
:
print
prefix
*
remainingChar
,
phrase
,
arg
elif
suffix
:
remainingChar
-=
len
(
phrase
)
+
len
(
arg
)
suffix
*=
remainingChar
if
key
==
'enter'
:
suffix
=
suffix
+
'>'
print
phrase
,
arg
,
suffix
else
:
print
phrase
,
arg
@
staticmethod
def
getSupportedPrintKwrds
():
return
(
"signal"
,
"signalReceiver"
,
"signalGiver"
,
"attemptSignal"
,
"attemptSignalGiver"
,
"attemptSignalReceiver"
,
"preempt"
,
"preempted"
,
"startWork"
,
"finishWork"
,
"processEnd"
,
"interrupted"
,
"enter"
,
"waitEvent"
,
"received"
,
"isRequested"
,
"canDispose"
,
"interruptionEnd"
,
"loadOperatorAvailable"
,
'resourceAvailable'
,
'conveyerEnd'
,
'conveyerFull'
,
'moveEnd'
)
@
staticmethod
def
getPhrase
():
printKwrds
=
{
'signal'
:{
'phrase'
:
'signalling'
},
'signalGiver'
:{
'phrase'
:
'signalling giver'
,
'prefix'
:
'_'
},
'signalReceiver'
:{
'phrase'
:
'signalling receiver'
,
'prefix'
:
'_'
},
'attemptSignal'
:{
'phrase'
:
'will try to signal'
},
'attemptSignalGiver'
:{
'phrase'
:
'will try to signal a giver'
},
'attemptSignalReceiver'
:{
'phrase'
:
'will try to signal a receiver'
},
'preempt'
:
{
'phrase'
:
'preempts'
,
'suffix'
:
' .'
},
'preempted'
:
{
'phrase'
:
'is being preempted'
,
'suffix'
:
'. '
},
'startWork'
:{
'phrase'
:
'started working in'
},
'finishWork'
:{
'phrase'
:
'finished working in'
},
'processEnd'
:{
'phrase'
:
'ended processing in'
},
'interrupted'
:{
'phrase'
:
'interrupted at'
,
'suffix'
:
' .'
},
'enter'
:{
'phrase'
:
'got into'
,
'suffix'
:
'='
},
'waitEvent'
:{
'phrase'
:
'will wait for event'
},
'received'
:{
'phrase'
:
'received event'
},
'isRequested'
:{
'phrase'
:
'received an isRequested event from'
},
'canDispose'
:{
'phrase'
:
'received an canDispose event'
},
'interruptionEnd'
:{
'phrase'
:
'received an interruptionEnd event at'
},
"loadOperatorAvailable"
:{
'phrase'
:
'received a loadOperatorAvailable event at'
},
"resourceAvailable"
:{
'phrase'
:
'received a resourceAvailable event'
},
'moveEnd'
:{
'phrase'
:
'received a moveEnd event'
},
"conveyerEnd"
:{
'phrase'
:
'has reached conveyer End'
,
'suffix'
:
'.!'
},
'conveyerFull'
:{
'phrase'
:
'is now Full, No of units:'
,
'suffix'
:
'(*)'
}}
return
printKwrds
# =======================================================================
# =======================================================================
# outputs data to "output.xls"
# outputs data to "output.xls"
# =======================================================================
# =======================================================================
...
...
dream/simulation/Dismantle.py
View file @
2934e764
...
@@ -117,12 +117,14 @@ class Dismantle(CoreObject):
...
@@ -117,12 +117,14 @@ class Dismantle(CoreObject):
# check if there is WIP and signal receiver
# check if there is WIP and signal receiver
self
.
initialSignalReceiver
()
self
.
initialSignalReceiver
()
while
1
:
while
1
:
self
.
printTrace
(
self
.
id
,
'will wait for frame event'
)
# self.printTrace(self.id, 'will wait for frame event')
self
.
printTrace1
(
self
.
id
,
waitEvent
=
'(frame)'
)
# wait until the Queue can accept an entity and one predecessor requests it
# wait until the Queue can accept an entity and one predecessor requests it
yield
waitevent
,
self
,
self
.
isRequested
#[self.isRequested,self.canDispose, self.loadOperatorAvailable]
yield
waitevent
,
self
,
self
.
isRequested
#[self.isRequested,self.canDispose, self.loadOperatorAvailable]
if
self
.
isRequested
.
signalparam
:
if
self
.
isRequested
.
signalparam
:
self
.
printTrace
(
self
.
id
,
'received a isRequested event from '
+
self
.
isRequested
.
signalparam
.
id
)
# self.printTrace(self.id, 'received a isRequested event from '+self.isRequested.signalparam.id)
self
.
printTrace1
(
self
.
id
,
isRequested
=
self
.
isRequested
.
signalparam
.
id
)
# reset the isRequested signal parameter
# reset the isRequested signal parameter
self
.
isRequested
.
signalparam
=
None
self
.
isRequested
.
signalparam
=
None
...
@@ -275,7 +277,8 @@ class Dismantle(CoreObject):
...
@@ -275,7 +277,8 @@ class Dismantle(CoreObject):
activeObject
.
waitToDisposePart
=
False
activeObject
.
waitToDisposePart
=
False
# if the internal queue is empty then try to signal the giver that the object can now receive
# if the internal queue is empty then try to signal the giver that the object can now receive
if
activeObject
.
canAccept
():
if
activeObject
.
canAccept
():
activeObject
.
printTrace
(
self
.
id
,
'will try signalling a giver from removeEntity'
)
# activeObject.printTrace(self.id, 'will try signalling a giver from removeEntity')
activeObject
.
printTrace1
(
self
.
id
,
attemptSingalGiver
=
'(removeEntity)'
)
activeObject
.
signalGiver
()
activeObject
.
signalGiver
()
return
activeEntity
return
activeEntity
...
...
dream/simulation/Machine.py
View file @
2934e764
...
@@ -221,12 +221,15 @@ class Machine(CoreObject):
...
@@ -221,12 +221,15 @@ class Machine(CoreObject):
while
1
:
while
1
:
# waitEvent isRequested /interruptionEnd/loadOperatorAvailable
# waitEvent isRequested /interruptionEnd/loadOperatorAvailable
while
1
:
while
1
:
self
.
printTrace
(
self
.
id
,
'will wait for event'
)
# self.printTrace(self.id, 'will wait for event')
self
.
printTrace1
(
self
.
id
,
waitEvent
=
''
)
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
interruptionEnd
,
self
.
loadOperatorAvailable
]
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
interruptionEnd
,
self
.
loadOperatorAvailable
]
self
.
printTrace
(
self
.
id
,
'received an event'
)
# self.printTrace(self.id, 'received an event')
self
.
printTrace1
(
self
.
id
,
received
=
''
)
# if the machine can accept an entity and one predecessor requests it continue with receiving the entity
# if the machine can accept an entity and one predecessor requests it continue with receiving the entity
if
self
.
isRequested
.
signalparam
:
if
self
.
isRequested
.
signalparam
:
self
.
printTrace
(
self
.
id
,
'received an isRequested event from'
+
self
.
isRequested
.
signalparam
.
id
)
# self.printTrace(self.id, 'received an isRequested event from'+self.isRequested.signalparam.id)
self
.
printTrace1
(
self
.
id
,
isRequested
=
self
.
isRequested
.
signalparam
.
id
)
assert
self
.
isRequested
.
signalparam
==
self
.
giver
,
'the giver is not the requestingObject'
assert
self
.
isRequested
.
signalparam
==
self
.
giver
,
'the giver is not the requestingObject'
assert
self
.
giver
.
receiver
==
self
,
'the receiver of the signalling object in not the station'
assert
self
.
giver
.
receiver
==
self
,
'the receiver of the signalling object in not the station'
# reset the signalparam of the isRequested event
# reset the signalparam of the isRequested event
...
@@ -236,9 +239,11 @@ class Machine(CoreObject):
...
@@ -236,9 +239,11 @@ class Machine(CoreObject):
# if an operator was rendered available while it was needed by the machine to proceed with getEntity
# if an operator was rendered available while it was needed by the machine to proceed with getEntity
if
self
.
interruptionEnd
.
signalparam
==
now
()
or
self
.
loadOperatorAvailable
.
signalparam
==
now
():
if
self
.
interruptionEnd
.
signalparam
==
now
()
or
self
.
loadOperatorAvailable
.
signalparam
==
now
():
if
self
.
interruptionEnd
.
signalparam
==
now
():
if
self
.
interruptionEnd
.
signalparam
==
now
():
self
.
printTrace
(
self
.
id
,
'received an interruptionEnd event sent at '
+
str
(
self
.
interruptionEnd
.
signalparam
))
# self.printTrace(self.id, 'received an interruptionEnd event sent at '+str(self.interruptionEnd.signalparam))
self
.
printTrace1
(
self
.
id
,
interruptionEnd
=
str
(
self
.
interruptionEnd
.
signalparam
))
elif
self
.
loadOperatorAvailable
.
signalparam
==
now
():
elif
self
.
loadOperatorAvailable
.
signalparam
==
now
():
self
.
printTrace
(
self
.
id
,
'received an loadOperatorAvailable event sent at '
+
str
(
self
.
loadOperatorAvailable
.
signalparam
))
# self.printTrace(self.id, 'received an loadOperatorAvailable event sent at '+str(self.loadOperatorAvailable.signalparam))
self
.
printTrace1
(
self
.
id
,
loadOperatorAvailable
=
str
(
self
.
loadOperatorAvailable
.
signalparam
))
# try to signal the Giver, otherwise wait until it is requested
# try to signal the Giver, otherwise wait until it is requested
if
self
.
signalGiver
():
if
self
.
signalGiver
():
break
break
...
@@ -463,7 +468,8 @@ class Machine(CoreObject):
...
@@ -463,7 +468,8 @@ class Machine(CoreObject):
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
activeEntity
=
activeObjectQueue
[
0
]
activeEntity
=
activeObjectQueue
[
0
]
self
.
printTrace
(
activeObject
.
getActiveObjectQueue
()[
0
].
name
,
"ended processing in "
+
activeObject
.
objName
)
# self.printTrace(activeObject.getActiveObjectQueue()[0].name,"ended processing in "+activeObject.objName)
self
.
printTrace1
(
activeObject
.
getActiveObjectQueue
()[
0
].
name
,
processEnd
=
activeObject
.
objName
)
# reset the variables used to handle the interruptions timing
# reset the variables used to handle the interruptions timing
self
.
timeRestartingProcessing
=
0
self
.
timeRestartingProcessing
=
0
self
.
breakTime
=
0
self
.
breakTime
=
0
...
@@ -513,7 +519,8 @@ class Machine(CoreObject):
...
@@ -513,7 +519,8 @@ class Machine(CoreObject):
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
activeEntity
=
activeObjectQueue
[
0
]
activeEntity
=
activeObjectQueue
[
0
]
self
.
printTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
"Interrupted at "
+
self
.
objName
+
'. '
*
5
)
# self.printTrace(self.getActiveObjectQueue()[0].name, "Interrupted at "+self.objName+'. '*5)
self
.
printTrace1
(
self
.
getActiveObjectQueue
()[
0
].
name
,
interrupted
=
self
.
objName
)
# if the interrupt occured while processing an entity
# if the interrupt occured while processing an entity
if
not
activeObject
.
waitToDispose
:
if
not
activeObject
.
waitToDispose
:
# output to trace that the Machine (self.objName) got interrupted
# output to trace that the Machine (self.objName) got interrupted
...
@@ -698,7 +705,8 @@ class Machine(CoreObject):
...
@@ -698,7 +705,8 @@ class Machine(CoreObject):
activeObject
.
waitToDispose
=
False
# update the waitToDispose flag
activeObject
.
waitToDispose
=
False
# update the waitToDispose flag
# if the Machine canAccept then signal a giver
# if the Machine canAccept then signal a giver
if
activeObject
.
canAccept
():
if
activeObject
.
canAccept
():
self
.
printTrace
(
self
.
id
,
'will try signalling a giver from removeEntity'
)
# self.printTrace(self.id, 'will try signalling a giver from removeEntity')
self
.
printTrace1
(
self
.
id
,
attemptSignalGiver
=
'(removeEntity)'
)
activeObject
.
signalGiver
()
activeObject
.
signalGiver
()
return
activeEntity
return
activeEntity
...
...
dream/simulation/MachineJobShop.py
View file @
2934e764
...
@@ -49,7 +49,8 @@ class MachineJobShop(Machine):
...
@@ -49,7 +49,8 @@ class MachineJobShop(Machine):
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
activeEntity
=
activeObjectQueue
[
0
]
activeEntity
=
activeObjectQueue
[
0
]
self
.
printTrace
(
activeObject
.
getActiveObjectQueue
()[
0
].
name
,
"ended processing in "
+
activeObject
.
objName
)
# self.printTrace(activeObject.getActiveObjectQueue()[0].name,"ended processing in "+activeObject.objName)
self
.
printTrace1
(
activeObject
.
getActiveObjectQueue
()[
0
].
name
,
processEnd
=
activeObject
.
objName
)
# reset the variables used to handle the interruptions timing
# reset the variables used to handle the interruptions timing
self
.
timeRestartingProcessing
=
0
self
.
timeRestartingProcessing
=
0
self
.
breakTime
=
0
self
.
breakTime
=
0
...
@@ -230,7 +231,8 @@ class MachineJobShop(Machine):
...
@@ -230,7 +231,8 @@ class MachineJobShop(Machine):
# method to execute preemption
# method to execute preemption
# =======================================================================
# =======================================================================
def
preempt
(
self
):
def
preempt
(
self
):
self
.
printTrace
(
self
.
id
,
'preempting'
+
' .'
*
7
)
# self.printTrace(self.id,'preempting'+' .'*7)
self
.
printTrace1
(
self
.
id
,
preempted
=
''
)
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeEntity
=
self
.
getActiveObjectQueue
()[
0
]
#get the active Entity
activeEntity
=
self
.
getActiveObjectQueue
()[
0
]
#get the active Entity
#calculate the remaining processing time
#calculate the remaining processing time
...
...
dream/simulation/MachineManagedJob.py
View file @
2934e764
...
@@ -105,7 +105,6 @@ class MachineManagedJob(MachineJobShop):
...
@@ -105,7 +105,6 @@ class MachineManagedJob(MachineJobShop):
# also updates the giver to the one that is to be taken
# also updates the giver to the one that is to be taken
# =======================================================================
# =======================================================================
def
canAcceptAndIsRequested
(
self
,
callerObject
=
None
):
def
canAcceptAndIsRequested
(
self
,
callerObject
=
None
):
# print self.id, 'CAAIR'
# get active and giver objects
# get active and giver objects
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
...
@@ -191,15 +190,3 @@ class MachineManagedJob(MachineJobShop):
...
@@ -191,15 +190,3 @@ class MachineManagedJob(MachineJobShop):
return
self
.
entityToGet
return
self
.
entityToGet
# # =======================================================================
# # prepare the machine to be released
# # =======================================================================
# def releaseOperator(self):
# self.outputTrace(self.currentOperator.objName, "released from "+ self.objName)
# # # TESTING
# # print now(), self.id, 'will release operator', self.operatorPool.operators[0].objName
# # set the flag operatorAssignedTo to None
# self.currentOperator.operatorAssignedTo=None
# self.broker.invokeBroker()
# self.toBeOperated = False
dream/simulation/OperatedPoolBroker.py
View file @
2934e764
...
@@ -71,11 +71,11 @@ class Broker(ObjectInterruption):
...
@@ -71,11 +71,11 @@ class Broker(ObjectInterruption):
# TODO: add new broker event - brokerIsCalled
# TODO: add new broker event - brokerIsCalled
yield
waitevent
,
self
,
self
.
isCalled
yield
waitevent
,
self
,
self
.
isCalled
assert
self
.
isCalled
.
signalparam
==
now
(),
'the broker should be granted control instantly'
assert
self
.
isCalled
.
signalparam
==
now
(),
'the broker should be granted control instantly'
self
.
victim
.
printTrace1
(
self
.
victim
.
id
,
received
=
'(broker)'
)
# ======= request a resource
# ======= request a resource
if
self
.
victim
.
isOperated
()
\
if
self
.
victim
.
isOperated
()
\
and
any
(
type
==
'Load'
or
type
==
'Setup'
or
type
==
'Processing'
\
and
any
(
type
==
'Load'
or
type
==
'Setup'
or
type
==
'Processing'
\
for
type
in
self
.
victim
.
multOperationTypeList
):
for
type
in
self
.
victim
.
multOperationTypeList
):
# self.printTrace(self.victim.id, 'broker is invoked')
# update the time that the station is waiting for the operator
# update the time that the station is waiting for the operator
self
.
timeWaitForOperatorStarted
=
now
()
self
.
timeWaitForOperatorStarted
=
now
()
#===============================================================
#===============================================================
...
@@ -87,24 +87,28 @@ class Broker(ObjectInterruption):
...
@@ -87,24 +87,28 @@ class Broker(ObjectInterruption):
if
not
self
.
victim
.
currentEntity
in
G
.
pendingEntities
:
if
not
self
.
victim
.
currentEntity
in
G
.
pendingEntities
:
G
.
pendingEntities
.
append
(
self
.
victim
.
currentEntity
)
G
.
pendingEntities
.
append
(
self
.
victim
.
currentEntity
)
if
not
G
.
Router
.
invoked
:
if
not
G
.
Router
.
invoked
:
self
.
printTrace
(
self
.
victim
.
id
,
'broker'
+
' '
*
50
+
'signalling router'
)
# self.printTrace(self.victim.id, 'broker'+' '*50+'signalling router')
self
.
victim
.
printTrace1
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
G
.
Router
.
invoked
=
True
G
.
Router
.
invoked
=
True
G
.
Router
.
isCalled
.
signal
(
now
())
G
.
Router
.
isCalled
.
signal
(
now
())
self
.
waitForOperator
=
True
self
.
waitForOperator
=
True
# self.printTrace(self.victim.id, 'broker waits till resource is available1')
# self.printTrace(self.victim.id, 'broker waits till resource is available1')
self
.
victim
.
printTrace1
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
yield
waitevent
,
self
,
self
.
resourceAvailable
yield
waitevent
,
self
,
self
.
resourceAvailable
# remove the currentEntity from the pendingEntities
# remove the currentEntity from the pendingEntities
if
self
.
victim
.
currentEntity
in
G
.
pendingEntities
:
if
self
.
victim
.
currentEntity
in
G
.
pendingEntities
:
G
.
pendingEntities
.
remove
(
self
.
victim
.
currentEntity
)
G
.
pendingEntities
.
remove
(
self
.
victim
.
currentEntity
)
self
.
waitForOperator
=
False
self
.
waitForOperator
=
False
# self.printTrace(self.victim.id, 'received resourceAvailable event')
# self.printTrace(self.victim.id, 'received resourceAvailable event')
self
.
victim
.
printTrace1
(
self
.
victim
.
id
,
resourceAvailable
=
'(broker)'
)
#===============================================================
#===============================================================
assert
self
.
victim
.
operatorPool
.
checkIfResourceIsAvailable
(),
'there is no available operator to request'
assert
self
.
victim
.
operatorPool
.
checkIfResourceIsAvailable
(),
'there is no available operator to request'
# set the available resource as the currentOperator
# set the available resource as the currentOperator
self
.
victim
.
currentOperator
=
self
.
victim
.
operatorPool
.
findAvailableOperator
()
self
.
victim
.
currentOperator
=
self
.
victim
.
operatorPool
.
findAvailableOperator
()
yield
request
,
self
,
self
.
victim
.
operatorPool
.
getResource
(
self
.
victim
.
currentOperator
)
yield
request
,
self
,
self
.
victim
.
operatorPool
.
getResource
(
self
.
victim
.
currentOperator
)
self
.
printTrace
(
self
.
victim
.
currentOperator
.
objName
,
'started work in '
+
self
.
victim
.
id
)
# self.printTrace(self.victim.currentOperator.objName, 'started work in '+self.victim.id)
self
.
victim
.
printTrace1
(
self
.
victim
.
currentOperator
.
objName
,
startWork
=
self
.
victim
.
id
)
# clear the timeWaitForOperatorStarted variable
# clear the timeWaitForOperatorStarted variable
self
.
timeWaitForOperatorStarted
=
0
self
.
timeWaitForOperatorStarted
=
0
# update the time that the operation started
# update the time that the operation started
...
@@ -121,7 +125,8 @@ class Broker(ObjectInterruption):
...
@@ -121,7 +125,8 @@ class Broker(ObjectInterruption):
# TODO: signalling the router must be done more elegantly, router must be set as global variable
# TODO: signalling the router must be done more elegantly, router must be set as global variable
# if the router is already invoked then do not signal it again
# if the router is already invoked then do not signal it again
if
not
self
.
victim
.
router
.
invoked
:
if
not
self
.
victim
.
router
.
invoked
:
self
.
printTrace
(
self
.
victim
.
id
,
'broker'
+
' '
*
50
+
'signalling ROUTER'
)
# self.printTrace(self.victim.id, 'broker'+' '*50+'signalling ROUTER')
self
.
victim
.
printTrace1
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
self
.
victim
.
router
.
invoked
=
True
self
.
victim
.
router
.
invoked
=
True
self
.
victim
.
router
.
isCalled
.
signal
(
now
())
self
.
victim
.
router
.
isCalled
.
signal
(
now
())
# TODO: signalling the router will give the chance to it to take the control, but when will it eventually receive it.
# TODO: signalling the router will give the chance to it to take the control, but when will it eventually receive it.
...
@@ -129,6 +134,7 @@ class Broker(ObjectInterruption):
...
@@ -129,6 +134,7 @@ class Broker(ObjectInterruption):
# TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers.
# TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers.
self
.
printTrace
(
self
.
victim
.
currentOperator
.
objName
,
'released '
+
self
.
victim
.
id
)
self
.
printTrace
(
self
.
victim
.
currentOperator
.
objName
,
'released '
+
self
.
victim
.
id
)
self
.
victim
.
printTrace1
(
self
.
victim
.
currentOperator
.
objName
,
finishWork
=
self
.
victim
.
id
)
# the victim current operator must be cleared after the operator is released
# the victim current operator must be cleared after the operator is released
self
.
timeLastOperationEnded
=
now
()
self
.
timeLastOperationEnded
=
now
()
self
.
victim
.
currentOperator
=
None
self
.
victim
.
currentOperator
=
None
...
...
dream/simulation/Queue.py
View file @
2934e764
...
@@ -93,13 +93,16 @@ class Queue(CoreObject):
...
@@ -93,13 +93,16 @@ class Queue(CoreObject):
# check if there is WIP and signal receiver
# check if there is WIP and signal receiver
self
.
initialSignalReceiver
()
self
.
initialSignalReceiver
()
while
1
:
while
1
:
self
.
printTrace
(
self
.
id
,
'will wait for event'
)
# self.printTrace(self.id, 'will wait for event')
self
.
printTrace1
(
self
.
id
,
waitEvent
=
''
)
# wait until the Queue can accept an entity and one predecessor requests it
# wait until the Queue can accept an entity and one predecessor requests it
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
canDispose
,
self
.
loadOperatorAvailable
]
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
canDispose
,
self
.
loadOperatorAvailable
]
self
.
printTrace
(
self
.
id
,
'just received an event'
)
# self.printTrace(self.id, 'just received an event')
self
.
printTrace1
(
self
.
id
,
received
=
''
)
# if the event that activated the thread is isRequested then getEntity
# if the event that activated the thread is isRequested then getEntity
if
self
.
isRequested
.
signalparam
:
if
self
.
isRequested
.
signalparam
:
self
.
printTrace
(
self
.
id
,
'received a isRequested event from'
+
self
.
isRequested
.
signalparam
.
id
)
# self.printTrace(self.id, 'received a isRequested event from'+self.isRequested.signalparam.id)
self
.
printTrace1
(
self
.
id
,
isRequested
=
self
.
isRequested
.
signalparam
.
id
)
# reset the isRequested signal parameter
# reset the isRequested signal parameter
self
.
isRequested
.
signalparam
=
None
self
.
isRequested
.
signalparam
=
None
self
.
getEntity
()
self
.
getEntity
()
...
@@ -109,14 +112,17 @@ class Queue(CoreObject):
...
@@ -109,14 +112,17 @@ class Queue(CoreObject):
# if the queue received an loadOperatorIsAvailable (from Router) with signalparam time
# if the queue received an loadOperatorIsAvailable (from Router) with signalparam time
if
self
.
loadOperatorAvailable
.
signalparam
:
if
self
.
loadOperatorAvailable
.
signalparam
:
# self.printTrace(self.id, 'received a loadOperatorAvailable event')
# self.printTrace(self.id, 'received a loadOperatorAvailable event')
# self.printTrace1(self.id, loadOperatorAvailable=str(self.loadOperatorAvailable.signalparam))
self
.
loadOperatorAvailable
.
signalparam
=
None
self
.
loadOperatorAvailable
.
signalparam
=
None
# if the queue received an canDispose with signalparam time, this means that the signals was sent from a MouldAssemblyBuffer
# if the queue received an canDispose with signalparam time, this means that the signals was sent from a MouldAssemblyBuffer
if
self
.
canDispose
.
signalparam
:
if
self
.
canDispose
.
signalparam
:
self
.
printTrace
(
self
.
id
,
'received a canDispose event'
)
# self.printTrace(self.id, 'received a canDispose event')
self
.
printTrace1
(
self
.
id
,
canDispose
=
''
)
self
.
canDispose
.
signalparam
=
None
self
.
canDispose
.
signalparam
=
None
# if the event that activated the thread is canDispose then signalReceiver
# if the event that activated the thread is canDispose then signalReceiver
if
self
.
haveToDispose
():
if
self
.
haveToDispose
():
self
.
printTrace
(
self
.
id
,
'will try to signal a receiver from generator'
)
# self.printTrace(self.id, 'will try to signal a receiver from generator')
self
.
printTrace1
(
self
.
id
,
attemptSignalReceiver
=
'(generator)'
)
if
self
.
receiver
:
if
self
.
receiver
:
if
not
self
.
receiver
.
entryIsAssignedTo
():
if
not
self
.
receiver
.
entryIsAssignedTo
():
self
.
signalReceiver
()
self
.
signalReceiver
()
...
@@ -170,6 +176,7 @@ class Queue(CoreObject):
...
@@ -170,6 +176,7 @@ class Queue(CoreObject):
if
not
self
.
__class__
.
__name__
==
'MouldAssemblyBuffer'
:
if
not
self
.
__class__
.
__name__
==
'MouldAssemblyBuffer'
:
if
self
.
haveToDispose
():
if
self
.
haveToDispose
():
self
.
printTrace
(
self
.
id
,
'will try to signal a receiver from removeEntity'
)
self
.
printTrace
(
self
.
id
,
'will try to signal a receiver from removeEntity'
)
self
.
printTrace1
(
self
.
id
,
attemptSignalReceiver
=
'(removeEntity)'
)
self
.
signalReceiver
()
self
.
signalReceiver
()
return
activeEntity
return
activeEntity
...
...
dream/simulation/QueueManagedJob.py
View file @
2934e764
...
@@ -113,7 +113,8 @@ class QueueManagedJob(QueueJobShop):
...
@@ -113,7 +113,8 @@ class QueueManagedJob(QueueJobShop):
if
receiver
.
identifyEntityToGet
().
manager
.
isAssignedTo
()
!=
receiver
:
if
receiver
.
identifyEntityToGet
().
manager
.
isAssignedTo
()
!=
receiver
:
from
Globals
import
G
from
Globals
import
G
if
not
G
.
Router
.
invoked
:
if
not
G
.
Router
.
invoked
:
self
.
printTrace
(
self
.
id
,
' '
*
50
+
'signalling router'
)
# self.printTrace(self.id,' '*50+'signalling router')
self
.
printTrace1
(
self
.
id
,
signal
=
'router'
)
G
.
Router
.
invoked
=
True
G
.
Router
.
invoked
=
True
G
.
Router
.
isCalled
.
signal
(
now
())
G
.
Router
.
isCalled
.
signal
(
now
())
return
True
return
True
...
...
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