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
bfb2dd03
Commit
bfb2dd03
authored
Feb 20, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new object operatorRouter
parent
b2696d2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
119 additions
and
0 deletions
+119
-0
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+119
-0
No files found.
dream/simulation/OperatorRouter.py
0 → 100644
View file @
bfb2dd03
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 19 Feb 2013
@author: Ioannis
'''
'''
Models an Interruption that schedules the operation of the machines by different managers
'''
from
SimPy.Simulation
import
Process
,
Resource
from
ObjectInterruption
import
ObjectInterruption
from
SimPy.Simulation
import
waituntil
,
now
,
hold
,
request
,
release
# ===========================================================================
# Class that handles the Operator Behavior
# ===========================================================================
class
Router
(
ObjectInterruption
):
# =======================================================================
# according to this implementation one machine per broker is allowed
# The Broker is initiated within the Machine and considered as
# black box for the ManPy end Developer
# =======================================================================
def
__init__
(
self
):
ObjectInterruption
.
__init__
(
self
)
self
.
type
=
"Router"
# variable used to hand in control to the Broker
self
.
call
=
False
# =======================================================================
# the run method
# =======================================================================
def
run
(
self
):
while
1
:
yield
waituntil
,
self
,
self
.
routerIsCalled
# wait until the router is called
# # TESTING
# print 'Router got called'
from
Globals
import
G
for
object
in
G
.
MachineList
:
if
object
.
inPositionToGet
:
object
.
canProceedWithGetEntity
=
True
self
.
inPositionToGet
=
False
# # TESTING
# import Globals
# giversList=[]
# for object in objList:
# for receiver in objList:
# if object.haveToDispose(receiver):
# giversList.append(object)
# # set the variable operatorAssignedTo to activeObject, the operator is then blocked
# activeObject.operatorPool.operators[0].operatorAssignedTo=activeObject
# # TESTING
# print now(), activeObject.operatorPool.operators[0].objName, 'got assigned to', activeObject.id
self
.
exitRouter
()
#===========================================================================
# have the entities that have ended their processing when the router
# got first called finished their moves through queues?
#===========================================================================
def
entitiesFinishedMoving
(
self
):
pass
# =======================================================================
# call the Scheduler
# filter for Broker - yield waituntil brokerIsCalled
# =======================================================================
def
routerIsCalled
(
self
):
return
self
.
call
# =======================================================================
# the broker returns control to OperatedMachine.Run
# filter for Machine - yield request/release operator
# =======================================================================
def
routerIsSet
(
self
):
return
not
self
.
call
# =======================================================================
# hand in the control to the Broker.run
# to be called by the machine
# =======================================================================
def
invokeRouter
(
self
):
self
.
call
=
True
# =======================================================================
# return control to the Machine.run
# =======================================================================
def
exitRouter
(
self
):
self
.
call
=
False
\ No newline at end of file
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