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
8a765025
Commit
8a765025
authored
Mar 06, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
invokeType flag added to broker
parent
1ebd69f7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
100 deletions
+118
-100
dream/simulation/Machine.py
dream/simulation/Machine.py
+4
-1
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+114
-99
No files found.
dream/simulation/Machine.py
View file @
8a765025
...
...
@@ -1156,6 +1156,7 @@ class Machine(CoreObject):
# prepare the machine to be operated
# =======================================================================
def
requestOperator
(
self
):
self
.
broker
.
invokeType
=
'request'
self
.
broker
.
invoke
()
self
.
toBeOperated
=
True
...
...
@@ -1177,6 +1178,7 @@ class Machine(CoreObject):
operator
.
timeLastShiftEnded
=
self
.
env
.
now
operator
.
unAssign
()
# set the flag operatorAssignedTo to None
operator
.
workingStation
=
None
self
.
toBeOperated
=
False
self
.
outputTrace
(
operator
.
name
,
"released from "
+
self
.
objName
)
# XXX in case of skilled operators which stay at the same station should that change
elif
not
operator
.
operatorDedicatedTo
==
self
:
...
...
@@ -1186,13 +1188,14 @@ class Machine(CoreObject):
# if the Router is expecting for signal send it
from
Globals
import
G
from
SkilledOperatorRouter
import
SkilledRouter
self
.
toBeOperated
=
False
if
G
.
RouterList
[
0
].
__class__
is
SkilledRouter
:
if
G
.
RouterList
[
0
].
expectedFinishSignals
:
if
self
.
id
in
G
.
RouterList
[
0
].
expectedFinishSignalsDict
:
signal
=
G
.
RouterList
[
0
].
expectedFinishSignalsDict
[
self
.
id
]
self
.
sendSignal
(
receiver
=
G
.
RouterList
[
0
],
signal
=
signal
)
self
.
broker
.
invokeType
=
'release'
self
.
broker
.
invoke
()
self
.
toBeOperated
=
False
# =======================================================================
# check if the machine is currently operated by an operator
...
...
dream/simulation/OperatedPoolBroker.py
View file @
8a765025
...
...
@@ -49,6 +49,9 @@ class Broker(ObjectInterruption):
self
.
timeLastOperationEnded
=
0
self
.
timeWaitForOperatorStarted
=
0
self
.
waitForOperator
=
False
# flag that shows if broker was called to request or release operator.
# Machine updates this before calling the broker
self
.
invokeType
=
'request'
#===========================================================================
# the initialize method
...
...
@@ -75,11 +78,13 @@ class Broker(ObjectInterruption):
self
.
expectedSignals
[
'isCalled'
]
=
1
yield
self
.
isCalled
# if self.victim.id=='St2M0':
# print self.env.now, self.victim.id, 'Broker Called',self.invokeType
transmitter
,
eventTime
=
self
.
isCalled
.
value
assert
eventTime
==
self
.
env
.
now
,
'the broker should be granted control instantly'
self
.
isCalled
=
self
.
env
.
event
()
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
received
=
'(broker)'
)
if
self
.
invokeType
==
'request'
:
# ======= request a resource
if
self
.
victim
.
isOperated
()
\
and
any
(
type
==
'Load'
or
type
==
'Setup'
or
type
==
'Processing'
\
...
...
@@ -145,6 +150,8 @@ class Broker(ObjectInterruption):
with
self
.
victim
.
operatorPool
.
getResource
(
self
.
victim
.
currentOperator
).
request
()
as
request
:
yield
request
if
self
.
victim
.
id
==
'St2M0'
:
print
1
# update the operator workingStation
self
.
victim
.
currentOperator
.
workingStation
=
self
.
victim
self
.
victim
.
printTrace
(
self
.
victim
.
currentOperator
.
objName
,
startWork
=
self
.
victim
.
id
)
...
...
@@ -178,14 +185,22 @@ class Broker(ObjectInterruption):
self
.
expectedSignals
[
'isCalled'
]
=
1
yield
self
.
isCalled
# if self.victim.id=='St2M0':
# print self.env.now, self.victim.id, 'Broker Called 2', self.invokeType
transmitter
,
eventTime
=
self
.
isCalled
.
value
assert
eventTime
==
self
.
env
.
now
,
'the broker should be granted control instantly'
self
.
isCalled
=
self
.
env
.
event
()
# The operator is released (the router is not called in the case of skilled ops that work constantly on the same machine)
if
self
.
invokeType
==
'release'
:
# if self.victim.id=='St2M0':
# print 2
# The operator is released (the router is not called in the case of skilled
# ops that work constantly on the same machine)
if
not
self
.
victim
.
currentOperator
.
operatorDedicatedTo
==
self
.
victim
:
if
not
self
.
victim
.
isOperated
():
# if self.victim.id=='St2M0':
# print 3
# signal the other brokers waiting for the same operators that they are now free
# also signal the stations that were not requested to receive because the operator was occupied
...
...
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