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
20bed7cb
Commit
20bed7cb
authored
Mar 10, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SkilledRouter to check conditions correctly
parent
bcac9132
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
9 deletions
+23
-9
dream/simulation/SkilledOperatorRouter.py
dream/simulation/SkilledOperatorRouter.py
+23
-9
No files found.
dream/simulation/SkilledOperatorRouter.py
View file @
20bed7cb
...
@@ -83,7 +83,7 @@ class SkilledRouter(Router):
...
@@ -83,7 +83,7 @@ class SkilledRouter(Router):
self
.
expectedSignals
[
'isCalled'
]
=
1
self
.
expectedSignals
[
'isCalled'
]
=
1
yield
self
.
isCalled
yield
self
.
isCalled
transmitter
,
eventTime
=
self
.
isCalled
.
value
transmitter
,
eventTime
=
self
.
isCalled
.
value
self
.
isCalled
=
self
.
env
.
event
()
self
.
isCalled
=
self
.
env
.
event
()
self
.
printTrace
(
''
,
'=-'
*
15
)
self
.
printTrace
(
''
,
'=-'
*
15
)
...
@@ -324,19 +324,22 @@ class SkilledRouter(Router):
...
@@ -324,19 +324,22 @@ class SkilledRouter(Router):
def
checkIfAllocationShouldBeCalled
(
self
):
def
checkIfAllocationShouldBeCalled
(
self
):
from
Globals
import
G
from
Globals
import
G
# loop through the operators. If for one the shift ended or started right now allocation is needed
# loop through the operators and the machines.
for
operator
in
G
.
OperatorsList
:
# If for one the shift ended or started right now allocation is needed
if
operator
.
timeLastShiftEnded
==
self
.
env
.
now
or
operator
.
timeLastShiftStarted
==
self
.
env
.
now
:
for
obj
in
G
.
OperatorsList
+
G
.
MachineList
:
# pass
if
(
obj
.
timeLastShiftEnded
==
self
.
env
.
now
)
or
(
obj
.
timeLastShiftStarted
==
self
.
env
.
now
):
return
True
return
True
# loop through the machines
# loop through the machines
for
machine
in
G
.
MachineList
:
for
machine
in
G
.
MachineList
:
# if one machine is starved more than 30 then allocation is needed
# if one machine is starved more than 30 then allocation is needed
if
(
self
.
env
.
now
-
machine
.
timeLastEntityEnded
>=
30
)
and
(
not
machine
.
isProcessing
):
if
(
self
.
env
.
now
-
machine
.
timeLastEntityLeft
>=
30
)
and
(
not
machine
.
getActiveObjectQueue
()):
# pass
return
True
return
True
previousList
=
self
.
getPreviousList
(
machine
)
# check for the previous buffer. If it is more than 80% full allocation is needed
parallelMachinesList
=
self
.
getParallelMachinesList
(
machine
)
previousQueue
=
self
.
getPreviousQueue
(
machine
)
if
previousQueue
:
if
float
(
len
(
previousQueue
.
getActiveObjectQueue
()))
/
float
(
previousQueue
.
capacity
)
>=
0.8
:
return
True
return
False
return
False
def
postProcessing
(
self
):
def
postProcessing
(
self
):
...
@@ -366,6 +369,17 @@ class SkilledRouter(Router):
...
@@ -366,6 +369,17 @@ class SkilledRouter(Router):
predecessor
=
predecessor
.
previous
[
0
]
predecessor
=
predecessor
.
previous
[
0
]
return
previousList
return
previousList
# for a machine gets the previous queue (if any)
def
getPreviousQueue
(
self
,
machine
):
predecessor
=
machine
.
previous
[
0
]
while
1
:
if
"Source"
in
str
(
predecessor
.
__class__
):
return
None
if
"Queue"
in
str
(
predecessor
.
__class__
)
or
"Clearance"
in
str
(
predecessor
.
__class__
):
return
predecessor
predecessor
=
predecessor
.
previous
[
0
]
# for a machine gets a list with the parallel machines
# for a machine gets a list with the parallel machines
def
getParallelMachinesList
(
self
,
machine
):
def
getParallelMachinesList
(
self
,
machine
):
alreadyConsidered
=
[
machine
]
alreadyConsidered
=
[
machine
]
...
...
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