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
fc9b82db
Commit
fc9b82db
authored
Sep 17, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Oct 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
router minor-cleanup
parent
e06031a0
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
116 deletions
+120
-116
dream/simulation/Machine.py
dream/simulation/Machine.py
+11
-11
dream/simulation/Operator.py
dream/simulation/Operator.py
+7
-3
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+99
-102
dream/simulation/OperatorRouterManaged.py
dream/simulation/OperatorRouterManaged.py
+3
-0
No files found.
dream/simulation/Machine.py
View file @
fc9b82db
...
@@ -1097,17 +1097,17 @@ class Machine(CoreObject):
...
@@ -1097,17 +1097,17 @@ class Machine(CoreObject):
return
self
.
loadRng
.
generateNumber
()
return
self
.
loadRng
.
generateNumber
()
#===========================================================================
#
#===========================================================================
# find candidate operators within the free operators
#
# find candidate operators within the free operators
#===========================================================================
#
#===========================================================================
def
findCandidateOperator
(
self
):
#
def findCandidateOperator(self):
# TODO: this way no sorting is performed
#
# TODO: this way no sorting is performed
# find an available operator
#
# find an available operator
candidateOperator
=
self
.
operatorPool
.
findAvailableOperator
()
#
candidateOperator=self.operatorPool.findAvailableOperator()
# append the station into its candidateStations
#
# append the station into its candidateStations
if
candidateOperator
:
# if there was an operator found append the Machine on his candidateStations
#
if candidateOperator: # if there was an operator found append the Machine on his candidateStations
candidateOperator
.
candidateStations
.
append
(
self
)
#
candidateOperator.candidateStations.append(self)
return
candidateOperator
#
return candidateOperator
#===========================================================================
#===========================================================================
# checks whether the entity can proceed to a successor object
# checks whether the entity can proceed to a successor object
...
...
dream/simulation/Operator.py
View file @
fc9b82db
...
@@ -200,12 +200,16 @@ class Operator(ObjectResource):
...
@@ -200,12 +200,16 @@ class Operator(ObjectResource):
machine
.
timeWaiting
=
self
.
env
.
now
-
machine
.
broker
.
timeWaitForOperatorStarted
machine
.
timeWaiting
=
self
.
env
.
now
-
machine
.
broker
.
timeWaitForOperatorStarted
else
:
else
:
machine
.
timeWaiting
=
self
.
env
.
now
-
machine
.
timeLastEntityLeft
machine
.
timeWaiting
=
self
.
env
.
now
-
machine
.
timeLastEntityLeft
# find the stations that hold
critical entities
# find the stations that hold
or are about to be delivered critical entities
if
self
in
router
.
preemptiveOperators
:
if
self
in
router
.
preemptiveOperators
:
for
entity
in
station
.
getActiveObjectQueue
():
for
entity
in
machine
.
getActiveObjectQueue
():
if
entity
.
isCritical
:
if
entity
in
router
.
pending
and
entity
.
isCritical
:
machine
.
critical
=
True
machine
.
critical
=
True
break
break
for
previous
in
machine
.
previous
:
for
entity
in
previous
.
getActiveObjectQueue
():
if
entity
in
router
.
pending
and
entity
.
isCritical
:
machine
.
critical
=
True
# sort the stations according their timeWaiting
# sort the stations according their timeWaiting
self
.
candidateStations
.
sort
(
key
=
lambda
x
:
x
.
timeWaiting
,
reverse
=
True
)
self
.
candidateStations
.
sort
(
key
=
lambda
x
:
x
.
timeWaiting
,
reverse
=
True
)
# sort the stations if they hold critical entities
# sort the stations if they hold critical entities
...
...
dream/simulation/OperatorRouter.py
View file @
fc9b82db
This diff is collapsed.
Click to expand it.
dream/simulation/OperatorRouterManaged.py
View file @
fc9b82db
...
@@ -52,6 +52,7 @@ class RouterManaged(Router):
...
@@ -52,6 +52,7 @@ class RouterManaged(Router):
self
.
schedulingRule
=
'WT'
self
.
schedulingRule
=
'WT'
# boolean flag to check whether the Router should perform sorting on operators and on pendingEntities
# boolean flag to check whether the Router should perform sorting on operators and on pendingEntities
self
.
sorting
=
sorting
self
.
sorting
=
sorting
self
.
entitiesWithOccupiedReceivers
=
[]
# list of entities that have no available receivers
#===========================================================================
#===========================================================================
# the initialize method
# the initialize method
...
@@ -67,6 +68,7 @@ class RouterManaged(Router):
...
@@ -67,6 +68,7 @@ class RouterManaged(Router):
self
.
multipleCriterionList
=
[]
self
.
multipleCriterionList
=
[]
# TODO: find out which must be the default for the scheduling Rule
# TODO: find out which must be the default for the scheduling Rule
self
.
schedulingRule
=
'WT'
self
.
schedulingRule
=
'WT'
self
.
entitiesWithOccupiedReceivers
=
[]
# =======================================================================
# =======================================================================
# the run method
# the run method
...
@@ -248,6 +250,7 @@ class RouterManaged(Router):
...
@@ -248,6 +250,7 @@ class RouterManaged(Router):
def
findPendingEntities
(
self
):
def
findPendingEntities
(
self
):
from
Globals
import
G
from
Globals
import
G
self
.
pending
=
[]
# list of entities that are pending
self
.
pending
=
[]
# list of entities that are pending
self
.
criticalPending
=
[]
for
machine
in
self
.
pendingMachines
:
for
machine
in
self
.
pendingMachines
:
self
.
pending
.
append
(
machine
.
currentEntity
)
self
.
pending
.
append
(
machine
.
currentEntity
)
for
entity
in
G
.
pendingEntities
:
for
entity
in
G
.
pendingEntities
:
...
...
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