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
fe7aa7a5
Commit
fe7aa7a5
authored
Feb 18, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new object OperatorManagedJob
parent
8b548ec6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
0 deletions
+81
-0
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+12
-0
dream/simulation/OperatorManagedJob.py
dream/simulation/OperatorManagedJob.py
+69
-0
No files found.
dream/simulation/LineGenerationJSON.py
View file @
fe7aa7a5
...
...
@@ -79,6 +79,7 @@ from BatchScrapMachine import BatchScrapMachine
from
LineClearance
import
LineClearance
from
EventGenerator
import
EventGenerator
from
Operator
import
Operator
from
OperatorManagedJob
import
OperatorManagedJob
from
OperatorPool
import
OperatorPool
from
OperatedPoolBroker
import
Broker
from
OperatedMachine
import
OperatedMachine
...
...
@@ -162,6 +163,7 @@ def createObjects():
G
.
LineClearanceList
=
[]
G
.
EventGeneratorList
=
[]
G
.
OperatorsList
=
[]
G
.
OperatorManagedJobsList
=
[]
G
.
OperatorPoolsList
=
[]
G
.
BrokersList
=
[]
G
.
OperatedMachineList
=
[]
...
...
@@ -203,6 +205,16 @@ def createObjects():
# calling the getSuccesorList() method on the operator
G
.
OperatorsList
.
append
(
O
)
# add the operator to the RepairmanList
G
.
ModelResourceList
.
append
(
O
)
elif
resourceClass
==
'Dream.OperatorManagedJob'
:
id
=
element
.
get
(
'id'
,
'not found'
)
# get the id of the element / default 'not_found'
name
=
element
.
get
(
'name'
,
'not found'
)
# get the name of the element / default 'not_found'
capacity
=
int
(
element
.
get
(
'capacity'
,
'1'
))
# get the capacity of the el. / defautl '1'
O
=
OperatorManagedJob
(
element_id
,
name
,
capacity
)
# create an operator object
O
.
coreObjectIds
=
getSuccessorList
(
id
)
# update the list of objects that the operator operates
# calling the getSuccesorList() method on the operator
G
.
OperatorsList
.
append
(
O
)
# add the operator to the RepairmanList
G
.
OperatorManagedJobsList
.
append
(
O
)
G
.
ModelResourceList
.
append
(
O
)
# -----------------------------------------------------------------------
# loop through all the model resources
# search for operatorPools in order to create them
...
...
dream/simulation/OperatorManagedJob.py
0 → 100644
View file @
fe7aa7a5
# ===========================================================================
# 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 13 Feb 2013
@author: Ioannis
'''
'''
models a entity/job assigned operator (manager)
'''
from
SimPy.Simulation
import
Resource
,
now
from
Operator
import
Operator
# ===========================================================================
# the resource that operates the machines
# ===========================================================================
class
OperatorManagedJob
(
Operator
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
):
Operator
.
__init__
(
self
,
id
=
id
,
name
=
name
,
capacity
=
capacity
)
self
.
operatorAssignedTo
=
None
# =======================================================================
# checks if the worker is available
# it is called only by the have to dispose of a QueueManagedJob
# and its sortEntities
# =======================================================================
def
checkIfResourceIsAvailable
(
self
,
callerObject
=
None
):
activeResourceQueue
=
self
.
getResourceQueue
()
# in case the operator has the flag operatorAssigned raised
# (meaning the operator will explicitly be assigned to a machine)
# return false even if he is free
# If there is no callerObject defined then do not check the operatorAssignedTo variable
if
callerObject
:
# if the operator is not yet assigned then return the default behaviour
if
self
.
operatorAssignedTo
==
None
:
return
len
(
activeResourceQueue
)
<
self
.
capacity
# otherwise, in case the operator is occupied, check if the occupier is the
# object the operator is assigned to
else
:
if
len
(
activeResourceQueue
):
if
self
.
operatorAssignedTo
==
activeResourceQueue
[
0
].
victim
:
return
self
.
operatorAssignedTo
==
callerObject
return
(
self
.
operatorAssignedTo
==
callerObject
)
and
len
(
self
.
Res
.
activeQ
)
<
self
.
capacity
# otherwise, (if the callerObject is None) check if the operator is assigned and if yes
# then perform the default behaviour
else
:
# if self.operatorAssignedTo==None:
# return False
return
len
(
self
.
Res
.
activeQ
)
<
self
.
capacity
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