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
aa014d4a
Commit
aa014d4a
authored
Feb 21, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new method added to OperatorRouter to monitor the movement of pendingEntities
parent
0168e35c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
12 deletions
+41
-12
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+35
-6
dream/simulation/Queue.py
dream/simulation/Queue.py
+6
-6
No files found.
dream/simulation/OperatorRouter.py
View file @
aa014d4a
...
@@ -52,17 +52,20 @@ class Router(ObjectInterruption):
...
@@ -52,17 +52,20 @@ class Router(ObjectInterruption):
# =======================================================================
# =======================================================================
def
run
(
self
):
def
run
(
self
):
while
1
:
while
1
:
yield
waituntil
,
self
,
self
.
routerIsCalled
# wait until the router is called
# wait until the router is called
# # TESTING
yield
waituntil
,
self
,
self
.
routerIsCalled
# print 'Router got called'
# when the router is called for the first time wait till all the entities
# finished all their moves in stations of non-Machine-type
# before they can enter again a type-Machine object
yield
waituntil
,
self
,
self
.
entitiesFinishedMoving
from
Globals
import
G
from
Globals
import
G
for
object
in
G
.
MachineList
:
for
object
in
G
.
MachineList
:
if
object
.
inPositionToGet
:
if
object
.
inPositionToGet
:
object
.
canProceedWithGetEntity
=
True
object
.
canProceedWithGetEntity
=
True
self
.
inPositionToGet
=
False
self
.
inPositionToGet
=
False
# have to check also the activeCallersList of each machine about to receive something
# # TESTING
# # TESTING
# import Globals
# import Globals
...
@@ -84,7 +87,33 @@ class Router(ObjectInterruption):
...
@@ -84,7 +87,33 @@ class Router(ObjectInterruption):
# got first called finished their moves through queues?
# got first called finished their moves through queues?
#===========================================================================
#===========================================================================
def
entitiesFinishedMoving
(
self
):
def
entitiesFinishedMoving
(
self
):
pass
# check if the entities waiting to be disposed from different Machines
# the first time the Router is called, have reached the last queue (if any)
# before the next Machine in their route
# from Globals import G
# # pending entities are entities about to enter an other machine, updated by endProcessingActions()
# # if there are any pending entities
# if len(G.pendingEntities):
# # for each one of them
# for entity in G.pendingEntities:
# # if they are residing in a machine which waits to dispose and is functional
# if entity.currentStation in G.MachineList:
# if entity.currentStation.checkIfMachineIsUp()\
# and entity.currentStation.waitToDispose:
# # if the next step in the entity's route is machine with Load operationType then continue
# if (not (entity.currentStation.receiver.type in G.MachineList)\
# and entity.currentStation.receiver.canAccept()\
# or\
# ((entity.currentStation.receiver.type in G.MachineList)\
# and not any(type=='Load' for type in entity.currentStation.receiver.multOperationTypeList))):
# return False
# elif entity.currentStation in G.QueueList:
# pass
# elif entity.currentStation in G.LineClearanceList:
# pass
# # this list can check all the available object in G.objList
return
True
# =======================================================================
# =======================================================================
# call the Scheduler
# call the Scheduler
...
...
dream/simulation/Queue.py
View file @
aa014d4a
...
@@ -83,9 +83,12 @@ class Queue(CoreObject):
...
@@ -83,9 +83,12 @@ class Queue(CoreObject):
def
initialize
(
self
):
def
initialize
(
self
):
# using the Process __init__ and not the CoreObject __init__
# using the Process __init__ and not the CoreObject __init__
CoreObject
.
initialize
(
self
)
CoreObject
.
initialize
(
self
)
# initiali
z
e the internal Queue (type Resource) of the Queue object
# initiali
s
e the internal Queue (type Resource) of the Queue object
self
.
Res
=
Resource
(
self
.
capacity
)
self
.
Res
=
Resource
(
self
.
capacity
)
#===========================================================================
# run method of the queue
#===========================================================================
def
run
(
self
):
def
run
(
self
):
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
...
@@ -97,6 +100,7 @@ class Queue(CoreObject):
...
@@ -97,6 +100,7 @@ class Queue(CoreObject):
#if entity just got to the dummyQ set its startTime as the current time
#if entity just got to the dummyQ set its startTime as the current time
if
self
.
isDummy
:
if
self
.
isDummy
:
activeObjectQueue
[
0
].
startTime
=
now
()
activeObjectQueue
[
0
].
startTime
=
now
()
# =======================================================================
# =======================================================================
# checks if the Queue can accept an entity
# checks if the Queue can accept an entity
# it checks also who called it and returns TRUE
# it checks also who called it and returns TRUE
...
@@ -139,10 +143,6 @@ class Queue(CoreObject):
...
@@ -139,10 +143,6 @@ class Queue(CoreObject):
if
(
len
(
activeObject
.
next
)
==
1
or
callerObject
==
None
):
if
(
len
(
activeObject
.
next
)
==
1
or
callerObject
==
None
):
return
len
(
self
.
Res
.
activeQ
)
>
0
return
len
(
self
.
Res
.
activeQ
)
>
0
# #if the Queue is empty it returns false right away
# if(len(activeObjectQueue)==0):
# return False
thecaller
=
callerObject
thecaller
=
callerObject
#give the entity to the possible receiver that is waiting for the most time.
#give the entity to the possible receiver that is waiting for the most time.
...
...
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