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
cedfdae2
Commit
cedfdae2
authored
Nov 26, 2013
by
Ioannis Papagiannopoulos
Committed by
Jérome Perrin
Dec 02, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OperatedMachine code clean-up
parent
2cb2d5a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
15 deletions
+32
-15
dream/simulation/OperatedMachine.py
dream/simulation/OperatedMachine.py
+32
-15
No files found.
dream/simulation/OperatedMachine.py
View file @
cedfdae2
...
@@ -95,11 +95,10 @@ class OperatedMachine(Machine):
...
@@ -95,11 +95,10 @@ class OperatedMachine(Machine):
# ======= request a resource
# ======= request a resource
if
(
self
.
operator
!=
"None"
):
if
(
self
.
operator
!=
"None"
):
# when it's ready to accept then inform the broker
# when it's ready to accept (canAcceptAndIsRequested) then inform the broker
self
.
invokeBroker
()
# machines waits to be operated (waits for the operator)
# machines waits to be operated (waits for the operator)
self
.
toBeOperated
=
True
self
.
operateMachine
()
# wait until the Broker
waited times equal to setupTime
# wait until the Broker
has waited times equal to setupTime (if any)
yield
waituntil
,
self
,
self
.
brokerIsSet
yield
waituntil
,
self
,
self
.
brokerIsSet
# get the entity
# get the entity
...
@@ -110,9 +109,8 @@ class OperatedMachine(Machine):
...
@@ -110,9 +109,8 @@ class OperatedMachine(Machine):
and
any
(
type
==
"Setup"
for
type
in
self
.
multOperationTypeList
)
\
and
any
(
type
==
"Setup"
for
type
in
self
.
multOperationTypeList
)
\
and
not
any
(
type
==
"Processing"
for
type
in
self
.
multOperationTypeList
):
and
not
any
(
type
==
"Processing"
for
type
in
self
.
multOperationTypeList
):
# after getting the entity release the operator
# after getting the entity release the operator
self
.
invokeBroker
()
# machine has to release the operator
# machine has to release the operator
self
.
toBeOperated
=
False
self
.
releaseMachine
()
# wait until the Broker has finished processing
# wait until the Broker has finished processing
yield
waituntil
,
self
,
self
.
brokerIsSet
yield
waituntil
,
self
,
self
.
brokerIsSet
...
@@ -166,8 +164,7 @@ class OperatedMachine(Machine):
...
@@ -166,8 +164,7 @@ class OperatedMachine(Machine):
# =============== release the operator if there is failure
# =============== release the operator if there is failure
if
(
self
.
operator
!=
"None"
)
\
if
(
self
.
operator
!=
"None"
)
\
and
any
(
type
==
"Processing"
for
type
in
self
.
multOperationTypeList
):
and
any
(
type
==
"Processing"
for
type
in
self
.
multOperationTypeList
):
self
.
invokeBroker
()
self
.
releaseMachine
()
self
.
toBeOperated
=
False
yield
waituntil
,
self
,
self
.
brokerIsSet
yield
waituntil
,
self
,
self
.
brokerIsSet
# if there is a failure in the machine it is passivated
# if there is a failure in the machine it is passivated
...
@@ -184,8 +181,7 @@ class OperatedMachine(Machine):
...
@@ -184,8 +181,7 @@ class OperatedMachine(Machine):
if
(
self
.
operator
!=
"None"
)
\
if
(
self
.
operator
!=
"None"
)
\
and
any
(
type
==
"Processing"
for
type
in
self
.
multOperationTypeList
)
\
and
any
(
type
==
"Processing"
for
type
in
self
.
multOperationTypeList
)
\
and
not
interruption
:
and
not
interruption
:
self
.
invokeBroker
()
self
.
operateMachine
()
self
.
toBeOperated
=
True
yield
waituntil
,
self
,
self
.
brokerIsSet
yield
waituntil
,
self
,
self
.
brokerIsSet
# if no interruption occurred the processing in M1 is ended
# if no interruption occurred the processing in M1 is ended
...
@@ -197,8 +193,7 @@ class OperatedMachine(Machine):
...
@@ -197,8 +193,7 @@ class OperatedMachine(Machine):
# =============== release resource after the end of processing
# =============== release resource after the end of processing
if
any
(
type
==
"Processing"
for
type
in
self
.
multOperationTypeList
)
\
if
any
(
type
==
"Processing"
for
type
in
self
.
multOperationTypeList
)
\
and
not
iterruption
:
and
not
iterruption
:
self
.
invokeBroker
()
self
.
releaseMachine
()
self
.
toBeOperated
=
False
yield
waituntil
,
self
,
self
.
brokerIsSet
yield
waituntil
,
self
,
self
.
brokerIsSet
...
@@ -325,13 +320,15 @@ class OperatedMachine(Machine):
...
@@ -325,13 +320,15 @@ class OperatedMachine(Machine):
return
self
.
stpRng
.
generateNumber
()
return
self
.
stpRng
.
generateNumber
()
# =======================================================================
# =======================================================================
# call the broker
# call the broker
# filter for yield waituntil
# =======================================================================
# =======================================================================
def
brokerIsCalled
(
self
):
def
brokerIsCalled
(
self
):
return
self
.
call
return
self
.
call
# =======================================================================
# =======================================================================
# the broker returns control to OperatedMachine.Run
# the broker returns control to OperatedMachine.Run
# filter for yield request/release
# =======================================================================
# =======================================================================
def
brokerIsSet
(
self
):
def
brokerIsSet
(
self
):
return
self
.
set
return
self
.
set
...
@@ -343,6 +340,26 @@ class OperatedMachine(Machine):
...
@@ -343,6 +340,26 @@ class OperatedMachine(Machine):
self
.
set
=
False
self
.
set
=
False
self
.
call
=
True
self
.
call
=
True
# =======================================================================
# prepare the machine to be operated
# =======================================================================
def
operateMachine
(
self
):
self
.
invokeBroker
()
self
.
toBeOperated
=
True
# =======================================================================
# prepare the machine to be released
# =======================================================================
def
releaseMachine
(
self
):
self
.
invokeBroker
()
self
.
toBeOperated
=
False
# =======================================================================
# check if the machine is currently operated
# =======================================================================
def
isOperated
(
self
):
return
self
.
toBeOperated
# ===========================================================================
# ===========================================================================
# Method that handles the Operator Behavior
# Method that handles the Operator Behavior
# ===========================================================================
# ===========================================================================
...
@@ -367,7 +384,7 @@ class Broker(Process):
...
@@ -367,7 +384,7 @@ class Broker(Process):
# ======= request a resource
# ======= request a resource
# have to see if the availability of resources is enough to check weather the machine is operated
# have to see if the availability of resources is enough to check weather the machine is operated
# or not
# or not
if
self
.
operatedMachine
.
toBeOperated
==
True
\
if
self
.
operatedMachine
.
isOperated
()
\
and
any
(
type
==
"Setup"
or
type
==
"Processing"
for
type
in
self
.
operatedMachine
.
multOperationTypeList
):
and
any
(
type
==
"Setup"
or
type
==
"Processing"
for
type
in
self
.
operatedMachine
.
multOperationTypeList
):
# update the time that the station is waiting for the operator
# update the time that the station is waiting for the operator
...
@@ -383,7 +400,7 @@ class Broker(Process):
...
@@ -383,7 +400,7 @@ class Broker(Process):
yield
hold
,
self
,
self
.
setupTime
yield
hold
,
self
,
self
.
setupTime
# ======= release a resource
# ======= release a resource
# have to see if the availability of resources is enough to check weather the machine is operated
# have to see if the availability of resources is enough to check weather the machine is operated
elif
self
.
operatedMachine
.
toBeOperated
!=
True
:
elif
not
self
.
operatedMachine
.
isOperated
()
:
self
.
operatedMachine
.
operator
.
totalWorkingTime
+=
now
()
-
self
.
timeOperationStarted
self
.
operatedMachine
.
operator
.
totalWorkingTime
+=
now
()
-
self
.
timeOperationStarted
yield
release
,
self
,
self
.
operatedMachine
.
operator
.
getResource
()
yield
release
,
self
,
self
.
operatedMachine
.
operator
.
getResource
()
...
...
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