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
f52b2011
Commit
f52b2011
authored
May 30, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
workingStation variable added to Operator to hold the station currently operated by the operator
parent
0fc1b914
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+3
-0
dream/simulation/Operator.py
dream/simulation/Operator.py
+2
-0
dream/simulation/OperatorManagedJob.py
dream/simulation/OperatorManagedJob.py
+7
-4
No files found.
dream/simulation/OperatedPoolBroker.py
View file @
f52b2011
...
@@ -112,6 +112,8 @@ class Broker(ObjectInterruption):
...
@@ -112,6 +112,8 @@ class Broker(ObjectInterruption):
with
self
.
victim
.
operatorPool
.
getResource
(
self
.
victim
.
currentOperator
).
request
()
as
request
:
with
self
.
victim
.
operatorPool
.
getResource
(
self
.
victim
.
currentOperator
).
request
()
as
request
:
yield
request
yield
request
# update the operator workingStation
self
.
victim
.
currentOperator
.
workingStation
=
self
.
victim
self
.
victim
.
printTrace
(
self
.
victim
.
currentOperator
.
objName
,
startWork
=
self
.
victim
.
id
)
self
.
victim
.
printTrace
(
self
.
victim
.
currentOperator
.
objName
,
startWork
=
self
.
victim
.
id
)
# clear the timeWaitForOperatorStarted variable
# clear the timeWaitForOperatorStarted variable
self
.
timeWaitForOperatorStarted
=
0
self
.
timeWaitForOperatorStarted
=
0
...
@@ -148,6 +150,7 @@ class Broker(ObjectInterruption):
...
@@ -148,6 +150,7 @@ class Broker(ObjectInterruption):
self
.
victim
.
printTrace
(
self
.
victim
.
currentOperator
.
objName
,
finishWork
=
self
.
victim
.
id
)
self
.
victim
.
printTrace
(
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
=
self
.
env
.
now
self
.
timeLastOperationEnded
=
self
.
env
.
now
self
.
victim
.
currentOperator
.
workingStation
=
None
self
.
victim
.
currentOperator
=
None
self
.
victim
.
currentOperator
=
None
else
:
else
:
pass
pass
...
...
dream/simulation/Operator.py
View file @
f52b2011
...
@@ -65,6 +65,8 @@ class Operator(ObjectResource):
...
@@ -65,6 +65,8 @@ class Operator(ObjectResource):
# the station that the operator is assigned to
# the station that the operator is assigned to
self
.
operatorAssignedTo
=
None
self
.
operatorAssignedTo
=
None
# the station the operator currently operating
self
.
workingStation
=
None
# variables to be used by OperatorRouter
# variables to be used by OperatorRouter
self
.
candidateEntities
=
[]
# list of the entities requesting the operator at a certain simulation Time
self
.
candidateEntities
=
[]
# list of the entities requesting the operator at a certain simulation Time
...
...
dream/simulation/OperatorManagedJob.py
View file @
f52b2011
...
@@ -26,7 +26,8 @@ Created on 13 Feb 2013
...
@@ -26,7 +26,8 @@ Created on 13 Feb 2013
models a entity/job assigned operator (manager)
models a entity/job assigned operator (manager)
'''
'''
from
SimPy.Simulation
import
Resource
,
now
# from SimPy.Simulation import Resource, now
import
simpy
from
Operator
import
Operator
from
Operator
import
Operator
# ===========================================================================
# ===========================================================================
...
@@ -45,6 +46,7 @@ class OperatorManagedJob(Operator):
...
@@ -45,6 +46,7 @@ class OperatorManagedJob(Operator):
# =======================================================================
# =======================================================================
def
checkIfResourceIsAvailable
(
self
,
callerObject
=
None
):
def
checkIfResourceIsAvailable
(
self
,
callerObject
=
None
):
activeResourceQueue
=
self
.
getResourceQueue
()
activeResourceQueue
=
self
.
getResourceQueue
()
workingOn
=
self
.
workingStation
# in case the operator has the flag operatorAssigned raised
# in case the operator has the flag operatorAssigned raised
# (meaning the operator will explicitly be assigned to a machine)
# (meaning the operator will explicitly be assigned to a machine)
# return false even if he is free
# return false even if he is free
...
@@ -57,15 +59,16 @@ class OperatorManagedJob(Operator):
...
@@ -57,15 +59,16 @@ class OperatorManagedJob(Operator):
# object the operator is assigned to
# object the operator is assigned to
else
:
else
:
if
len
(
activeResourceQueue
):
if
len
(
activeResourceQueue
):
if
self
.
operatorAssignedTo
==
activeResourceQueue
[
0
].
victim
:
# if self.operatorAssignedTo==activeResourceQueue[0].victim:
if
self
.
operatorAssignedTo
==
workingOn
:
return
self
.
operatorAssignedTo
==
callerObject
return
self
.
operatorAssignedTo
==
callerObject
return
(
self
.
operatorAssignedTo
==
callerObject
)
and
len
(
self
.
Res
.
activeQ
)
<
self
.
capacity
return
(
self
.
operatorAssignedTo
==
callerObject
)
and
len
(
activeResourceQueue
)
<
self
.
capacity
# otherwise, (if the callerObject is None) check if the operator is assigned and if yes
# otherwise, (if the callerObject is None) check if the operator is assigned and if yes
# then perform the default behaviour
# then perform the default behaviour
else
:
else
:
# if self.operatorAssignedTo==None:
# if self.operatorAssignedTo==None:
# return False
# return False
return
len
(
self
.
Res
.
activeQ
)
<
self
.
capacity
return
len
(
activeResourceQueue
)
<
self
.
capacity
#===========================================================================
#===========================================================================
# check if the operator has only one station as candidate option
# check if the operator has only one station as candidate option
...
...
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