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
a7b17789
Commit
a7b17789
authored
Sep 08, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first version of ManPyObject. All abstract classes inherit from it
parent
0302f672
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
64 additions
and
30 deletions
+64
-30
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+3
-2
dream/simulation/Entity.py
dream/simulation/Entity.py
+3
-3
dream/simulation/Failure.py
dream/simulation/Failure.py
+3
-5
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+2
-2
dream/simulation/Machine.py
dream/simulation/Machine.py
+1
-1
dream/simulation/MachineManagedJob.py
dream/simulation/MachineManagedJob.py
+1
-7
dream/simulation/ManPyObject.py
dream/simulation/ManPyObject.py
+37
-0
dream/simulation/ObjectInterruption.py
dream/simulation/ObjectInterruption.py
+4
-2
dream/simulation/ObjectResource.py
dream/simulation/ObjectResource.py
+4
-2
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+2
-2
dream/simulation/ScheduledMaintenance.py
dream/simulation/ScheduledMaintenance.py
+2
-2
dream/simulation/ShiftScheduler.py
dream/simulation/ShiftScheduler.py
+2
-2
No files found.
dream/simulation/CoreObject.py
View file @
a7b17789
...
@@ -27,15 +27,16 @@ Class that acts as an abstract. It should have no instances. All the core-object
...
@@ -27,15 +27,16 @@ Class that acts as an abstract. It should have no instances. All the core-object
# from SimPy.Simulation import Process, Resource, now, SimEvent, waitevent
# from SimPy.Simulation import Process, Resource, now, SimEvent, waitevent
import
simpy
import
simpy
from
ManPyObject
import
ManPyObject
# ===========================================================================
# ===========================================================================
# the core object
# the core object
# ===========================================================================
# ===========================================================================
class
CoreObject
(
o
bject
):
class
CoreObject
(
ManPyO
bject
):
class_name
=
'Dream.CoreObject'
class_name
=
'Dream.CoreObject'
def
__init__
(
self
,
id
,
name
,
inputsDict
=
{},
**
kw
):
def
__init__
(
self
,
id
,
name
,
inputsDict
=
{},
**
kw
):
self
.
id
=
id
ManPyObject
.
__init__
(
self
,
id
,
name
)
self
.
objName
=
name
self
.
objName
=
name
# lists that hold the previous and next objects in the flow
# lists that hold the previous and next objects in the flow
self
.
next
=
[]
#list with the next objects in the flow
self
.
next
=
[]
#list with the next objects in the flow
...
...
dream/simulation/Entity.py
View file @
a7b17789
...
@@ -27,17 +27,17 @@ Class that acts as an abstract. It should have no instances. All the Entities sh
...
@@ -27,17 +27,17 @@ Class that acts as an abstract. It should have no instances. All the Entities sh
# from SimPy.Simulation import now
# from SimPy.Simulation import now
import
simpy
import
simpy
from
ManPyObject
import
ManPyObject
# ===========================================================================
# ===========================================================================
# The entity object
# The entity object
# ===========================================================================
# ===========================================================================
class
Entity
(
o
bject
):
class
Entity
(
ManPyO
bject
):
type
=
"Entity"
type
=
"Entity"
def
__init__
(
self
,
id
=
None
,
name
=
None
,
priority
=
0
,
dueDate
=
0
,
orderDate
=
0
,
def
__init__
(
self
,
id
=
None
,
name
=
None
,
priority
=
0
,
dueDate
=
0
,
orderDate
=
0
,
isCritical
=
False
,
remainingProcessingTime
=
0
,
currentStation
=
None
,
**
kw
):
isCritical
=
False
,
remainingProcessingTime
=
0
,
currentStation
=
None
,
**
kw
):
self
.
name
=
name
ManPyObject
.
__init__
(
self
,
id
,
name
)
self
.
id
=
id
# information on the object holding the entity
# information on the object holding the entity
# initialized as None and updated every time an entity enters a new object
# initialized as None and updated every time an entity enters a new object
# information on the lifespan of the entity
# information on the lifespan of the entity
...
...
dream/simulation/Failure.py
View file @
a7b17789
...
@@ -34,10 +34,9 @@ from ObjectInterruption import ObjectInterruption
...
@@ -34,10 +34,9 @@ from ObjectInterruption import ObjectInterruption
class
Failure
(
ObjectInterruption
):
class
Failure
(
ObjectInterruption
):
def
__init__
(
self
,
victim
=
None
,
distribution
=
None
,
index
=
0
,
repairman
=
None
,
offshift
=
False
,
def
__init__
(
self
,
id
=
''
,
name
=
''
,
victim
=
None
,
distribution
=
None
,
index
=
0
,
repairman
=
None
,
offshift
=
False
,
deteriorationType
=
'constant'
,
**
kw
):
deteriorationType
=
'constant'
,
**
kw
):
#Process.__init__(self)
ObjectInterruption
.
__init__
(
self
,
id
,
name
,
victim
=
victim
)
ObjectInterruption
.
__init__
(
self
,
victim
)
if
distribution
:
if
distribution
:
self
.
distType
=
distribution
.
get
(
'distributionType'
,
'No'
)
# the distribution that the failure duration follows
self
.
distType
=
distribution
.
get
(
'distributionType'
,
'No'
)
# the distribution that the failure duration follows
self
.
MTTF
=
distribution
.
get
(
'MTTF'
,
60
)
# the MTTF
self
.
MTTF
=
distribution
.
get
(
'MTTF'
,
60
)
# the MTTF
...
@@ -146,8 +145,7 @@ class Failure(ObjectInterruption):
...
@@ -146,8 +145,7 @@ class Failure(ObjectInterruption):
self
.
victimStartsProcess
=
self
.
env
.
event
()
self
.
victimStartsProcess
=
self
.
env
.
event
()
else
:
else
:
failureNotTriggered
=
False
failureNotTriggered
=
False
# interrupt the victim only if it was not previously interrupted
# interrupt the victim only if it was not previously interrupted
if
not
self
.
victim
.
interruptionStart
.
triggered
:
if
not
self
.
victim
.
interruptionStart
.
triggered
:
self
.
interruptVictim
()
# interrupt the victim
self
.
interruptVictim
()
# interrupt the victim
...
...
dream/simulation/LineGenerationJSON.py
View file @
a7b17789
...
@@ -297,7 +297,7 @@ def createObjectInterruptions():
...
@@ -297,7 +297,7 @@ def createObjectInterruptions():
else
:
else
:
victim
=
Globals
.
findObjectById
(
element
[
'id'
])
victim
=
Globals
.
findObjectById
(
element
[
'id'
])
deteriorationType
=
failure
.
get
(
'deteriorationType'
,
'constant'
)
deteriorationType
=
failure
.
get
(
'deteriorationType'
,
'constant'
)
F
=
Failure
(
victim
,
distribution
=
failure
,
repairman
=
victim
.
repairman
,
deteriorationType
=
deteriorationType
)
F
=
Failure
(
victim
=
victim
,
distribution
=
failure
,
repairman
=
victim
.
repairman
,
deteriorationType
=
deteriorationType
)
G
.
ObjectInterruptionList
.
append
(
F
)
G
.
ObjectInterruptionList
.
append
(
F
)
G
.
FailureList
.
append
(
F
)
G
.
FailureList
.
append
(
F
)
# if there is a shift pattern defined
# if there is a shift pattern defined
...
@@ -317,7 +317,7 @@ def createObjectInterruptions():
...
@@ -317,7 +317,7 @@ def createObjectInterruptions():
shiftPattern
.
remove
(
next
)
shiftPattern
.
remove
(
next
)
endUnfinished
=
bool
(
int
(
shift
.
get
(
'endUnfinished'
,
0
)))
endUnfinished
=
bool
(
int
(
shift
.
get
(
'endUnfinished'
,
0
)))
receiveBeforeEndThreshold
=
float
(
shift
.
get
(
'receiveBeforeEndThreshold'
,
0
))
receiveBeforeEndThreshold
=
float
(
shift
.
get
(
'receiveBeforeEndThreshold'
,
0
))
SS
=
ShiftScheduler
(
victim
,
shiftPattern
=
shiftPattern
,
endUnfinished
=
endUnfinished
,
SS
=
ShiftScheduler
(
victim
=
victim
,
shiftPattern
=
shiftPattern
,
endUnfinished
=
endUnfinished
,
receiveBeforeEndThreshold
=
receiveBeforeEndThreshold
)
receiveBeforeEndThreshold
=
receiveBeforeEndThreshold
)
G
.
ObjectInterruptionList
.
append
(
SS
)
G
.
ObjectInterruptionList
.
append
(
SS
)
G
.
ShiftSchedulerList
.
append
(
SS
)
G
.
ShiftSchedulerList
.
append
(
SS
)
...
...
dream/simulation/Machine.py
View file @
a7b17789
...
@@ -254,7 +254,7 @@ class Machine(CoreObject):
...
@@ -254,7 +254,7 @@ class Machine(CoreObject):
def
createBroker
(
self
):
def
createBroker
(
self
):
# initiate the Broker and the router
# initiate the Broker and the router
if
(
self
.
operatorPool
!=
'None'
):
if
(
self
.
operatorPool
!=
'None'
):
self
.
broker
=
Broker
(
self
)
self
.
broker
=
Broker
(
operatedMachine
=
self
)
#===========================================================================
#===========================================================================
# create router if needed
# create router if needed
...
...
dream/simulation/MachineManagedJob.py
View file @
a7b17789
...
@@ -59,13 +59,7 @@ class MachineManagedJob(MachineJobShop):
...
@@ -59,13 +59,7 @@ class MachineManagedJob(MachineJobShop):
from
Globals
import
G
from
Globals
import
G
G
.
OperatorPoolsList
.
append
(
self
.
operatorPool
)
G
.
OperatorPoolsList
.
append
(
self
.
operatorPool
)
#===========================================================================
# create broker if needed
#===========================================================================
def
createBroker
(
self
):
#create a Broker
self
.
broker
=
Broker
(
self
)
#===========================================================================
#===========================================================================
# create router if needed
# create router if needed
#===========================================================================
#===========================================================================
...
...
dream/simulation/ManPyObject.py
0 → 100644
View file @
a7b17789
# ===========================================================================
# 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 08 Sep 2014
@author: George
'''
'''
Class that acts as an abstract. It should have no instances. All ManPy objects inherit from it
Also only abstract ManPy classes inherit directly (CoreObject, Entity, ObjectResource, ObjectInterruption)
'''
# ===========================================================================
# the ManPy object
# ===========================================================================
class
ManPyObject
(
object
):
def
__init__
(
self
,
id
,
name
,
**
kw
):
self
.
id
=
id
self
.
name
=
name
dream/simulation/ObjectInterruption.py
View file @
a7b17789
...
@@ -28,13 +28,15 @@ Class that acts as an abstract. It should have no instances. All object interrup
...
@@ -28,13 +28,15 @@ Class that acts as an abstract. It should have no instances. All object interrup
# from SimPy.Simulation import Process, Resource, reactivate, now
# from SimPy.Simulation import Process, Resource, reactivate, now
import
simpy
import
simpy
from
ManPyObject
import
ManPyObject
#===============================================================================
#===============================================================================
# The ObjectInterruption process
# The ObjectInterruption process
#===============================================================================
#===============================================================================
class
ObjectInterruption
(
o
bject
):
class
ObjectInterruption
(
ManPyO
bject
):
def
__init__
(
self
,
victim
=
None
,
**
kw
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
victim
=
None
,
**
kw
):
ManPyObject
.
__init__
(
self
,
id
,
name
)
self
.
victim
=
victim
self
.
victim
=
victim
# variable used to hand in control to the objectInterruption
# variable used to hand in control to the objectInterruption
self
.
call
=
False
self
.
call
=
False
...
...
dream/simulation/ObjectResource.py
View file @
a7b17789
...
@@ -26,13 +26,15 @@ Class that acts as an abstract. It should have no instances. All the Resources s
...
@@ -26,13 +26,15 @@ Class that acts as an abstract. It should have no instances. All the Resources s
'''
'''
# from SimPy.Simulation import Resource
# from SimPy.Simulation import Resource
import
simpy
import
simpy
from
ManPyObject
import
ManPyObject
# ===========================================================================
# ===========================================================================
# the resource that repairs the machines
# the resource that repairs the machines
# ===========================================================================
# ===========================================================================
class
ObjectResource
(
o
bject
):
class
ObjectResource
(
ManPyO
bject
):
def
__init__
(
self
,
**
kw
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
**
kw
):
ManPyObject
.
__init__
(
self
,
id
,
name
)
self
.
initialized
=
False
self
.
initialized
=
False
# list that holds the objectInterruptions that have this element as victim
# list that holds the objectInterruptions that have this element as victim
self
.
objectInterruptions
=
[]
self
.
objectInterruptions
=
[]
...
...
dream/simulation/OperatedPoolBroker.py
View file @
a7b17789
...
@@ -41,8 +41,8 @@ class Broker(ObjectInterruption):
...
@@ -41,8 +41,8 @@ class Broker(ObjectInterruption):
# The Broker is initiated within the Machine and considered as
# The Broker is initiated within the Machine and considered as
# black box for the ManPy end Developer
# black box for the ManPy end Developer
# =======================================================================
# =======================================================================
def
__init__
(
self
,
operatedMachi
ne
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
operatedMachine
=
No
ne
):
ObjectInterruption
.
__init__
(
self
,
operatedMachine
)
ObjectInterruption
.
__init__
(
self
,
id
,
name
,
victim
=
operatedMachine
)
self
.
type
=
"Broker"
self
.
type
=
"Broker"
# variables that have to do with timing
# variables that have to do with timing
self
.
timeOperationStarted
=
0
self
.
timeOperationStarted
=
0
...
...
dream/simulation/ScheduledMaintenance.py
View file @
a7b17789
...
@@ -38,14 +38,14 @@ class ScheduledMaintenance(ObjectInterruption):
...
@@ -38,14 +38,14 @@ class ScheduledMaintenance(ObjectInterruption):
# =======================================================================
# =======================================================================
# the __init__() method of the class
# the __init__() method of the class
# =======================================================================
# =======================================================================
def
__init__
(
self
,
victim
=
None
,
start
=
0
,
duration
=
1
,
endStatus
=
'interrupted'
,
**
kw
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
victim
=
None
,
start
=
0
,
duration
=
1
,
endStatus
=
'interrupted'
,
**
kw
):
'''
'''
interrupted : the maintenance starts immediately
interrupted : the maintenance starts immediately
loaded : the maintenance starts as soon as the victim has ended processing
loaded : the maintenance starts as soon as the victim has ended processing
emptied : the maintenance starts as soon as the victim is empty
emptied : the maintenance starts as soon as the victim is empty
'''
'''
self
.
type
=
"ScheduledMaintenance"
self
.
type
=
"ScheduledMaintenance"
ObjectInterruption
.
__init__
(
self
,
victim
)
ObjectInterruption
.
__init__
(
self
,
victim
=
victim
)
self
.
start
=
start
self
.
start
=
start
self
.
duration
=
duration
self
.
duration
=
duration
# the victim can be 'interrupted', 'loaded' or 'emptied' when the maintenance interruption happens
# the victim can be 'interrupted', 'loaded' or 'emptied' when the maintenance interruption happens
...
...
dream/simulation/ShiftScheduler.py
View file @
a7b17789
...
@@ -39,8 +39,8 @@ class ShiftScheduler(ObjectInterruption):
...
@@ -39,8 +39,8 @@ class ShiftScheduler(ObjectInterruption):
# =======================================================================
# =======================================================================
# the __init__() method of the class
# the __init__() method of the class
# =======================================================================
# =======================================================================
def
__init__
(
self
,
victim
=
None
,
shiftPattern
=
[],
endUnfinished
=
False
,
receiveBeforeEndThreshold
=
0.0
,
**
kw
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
victim
=
None
,
shiftPattern
=
[],
endUnfinished
=
False
,
receiveBeforeEndThreshold
=
0.0
,
**
kw
):
ObjectInterruption
.
__init__
(
self
,
victim
)
ObjectInterruption
.
__init__
(
self
,
victim
=
victim
)
self
.
type
=
'ShiftScheduler'
self
.
type
=
'ShiftScheduler'
self
.
shiftPattern
=
shiftPattern
self
.
shiftPattern
=
shiftPattern
self
.
endUnfinished
=
endUnfinished
#flag that shows if half processed Jobs should end after the shift ends
self
.
endUnfinished
=
endUnfinished
#flag that shows if half processed Jobs should end after the shift ends
...
...
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