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
5190dff0
Commit
5190dff0
authored
Jun 03, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
objects updated so that the env and also signals are set in initialize
parent
7d8291bf
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
24 additions
and
57 deletions
+24
-57
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+5
-4
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+4
-24
dream/simulation/Machine.py
dream/simulation/Machine.py
+0
-9
dream/simulation/MachineManagedJob.py
dream/simulation/MachineManagedJob.py
+2
-0
dream/simulation/ObjectInterruption.py
dream/simulation/ObjectInterruption.py
+2
-2
dream/simulation/ObjectResource.py
dream/simulation/ObjectResource.py
+2
-2
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+4
-3
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+2
-2
dream/simulation/Queue.py
dream/simulation/Queue.py
+0
-2
dream/simulation/Source.py
dream/simulation/Source.py
+3
-9
No files found.
dream/simulation/Conveyer.py
View file @
5190dff0
...
@@ -55,7 +55,6 @@ class Conveyer(CoreObject):
...
@@ -55,7 +55,6 @@ class Conveyer(CoreObject):
# when the entities have to be loaded to operatedMachines
# when the entities have to be loaded to operatedMachines
# then the giverObjects have to be blocked for the time
# then the giverObjects have to be blocked for the time
# that the machine is being loaded
# that the machine is being loaded
self
.
moveEnd
=
self
.
env
.
event
()
#===========================================================================
#===========================================================================
# the initialize method
# the initialize method
...
@@ -85,6 +84,8 @@ class Conveyer(CoreObject):
...
@@ -85,6 +84,8 @@ class Conveyer(CoreObject):
self
.
successorIndex
=
0
#holds the index of the successor where the Queue Conveyer dispose an entity next
self
.
successorIndex
=
0
#holds the index of the successor where the Queue Conveyer dispose an entity next
self
.
requestingEntities
=
[]
# list of the entities requesting space on the conveyer
self
.
requestingEntities
=
[]
# list of the entities requesting space on the conveyer
# signal that notifies the conveyer that its move is completed
self
.
moveEnd
=
self
.
env
.
event
()
#===========================================================================
#===========================================================================
# conveyer generator
# conveyer generator
...
@@ -521,8 +522,8 @@ class ConveyerMover(object):
...
@@ -521,8 +522,8 @@ class ConveyerMover(object):
yield
self
.
env
.
timeout
(
self
.
timeToWait
)
#wait for the time that the conveyer calculated
yield
self
.
env
.
timeout
(
self
.
timeToWait
)
#wait for the time that the conveyer calculated
# continue if interrupted
# continue if interrupted
self
.
conveyer
.
moveEntities
()
#move the entities of the conveyer
self
.
conveyer
.
moveEntities
()
#
move the entities of the conveyer
self
.
conveyer
.
moveEnd
.
succeed
(
self
.
env
.
now
)
self
.
conveyer
.
moveEnd
.
succeed
(
self
.
env
.
now
)
# send a signal to the conveyer that the move has ended
dream/simulation/CoreObject.py
View file @
5190dff0
...
@@ -34,9 +34,6 @@ import simpy
...
@@ -34,9 +34,6 @@ import simpy
class
CoreObject
(
object
):
class
CoreObject
(
object
):
def
__init__
(
self
,
id
,
name
,
**
kw
):
def
__init__
(
self
,
id
,
name
,
**
kw
):
from
Globals
import
G
self
.
env
=
G
.
env
# Process.__init__(self)
self
.
id
=
id
self
.
id
=
id
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
...
@@ -56,23 +53,10 @@ class CoreObject(object):
...
@@ -56,23 +53,10 @@ class CoreObject(object):
self
.
resetOnPreemption
=
False
self
.
resetOnPreemption
=
False
self
.
interruptCause
=
None
self
.
interruptCause
=
None
self
.
gatherWipStat
=
False
self
.
gatherWipStat
=
False
# signalizing an event that activates the generator
# self.isRequested=SimEvent('isRequested')
self
.
isRequested
=
self
.
env
.
event
()
# self.canDispose=SimEvent('canDispose')
self
.
canDispose
=
self
.
env
.
event
()
# self.interruptionEnd=SimEvent('interruptionEnd')
self
.
interruptionEnd
=
self
.
env
.
event
()
# self.interruptionStart=SimEvent('interruptionStart')
self
.
interruptionStart
=
self
.
env
.
event
()
# variable that holds the the type of interruption interrupting the station
self
.
interruptedBy
=
None
self
.
entityRemoved
=
self
.
env
.
event
()
def
initialize
(
self
):
def
initialize
(
self
):
# XXX why call super.__init__ outside of __init__ ?
from
Globals
import
G
# Process.__init__(self)
self
.
env
=
G
.
env
self
.
Up
=
True
#Boolean that shows if the machine is in failure ("Down") or not ("up")
self
.
Up
=
True
#Boolean that shows if the machine is in failure ("Down") or not ("up")
self
.
onShift
=
True
self
.
onShift
=
True
self
.
currentEntity
=
None
self
.
currentEntity
=
None
...
@@ -143,16 +127,12 @@ class CoreObject(object):
...
@@ -143,16 +127,12 @@ class CoreObject(object):
# TODO, think what to do in multiple runs
# TODO, think what to do in multiple runs
# TODO, this should be also updated in Globals.setWIP (in case we have initial wip)
# TODO, this should be also updated in Globals.setWIP (in case we have initial wip)
self
.
wipStatList
=
[[
0
,
0
]]
self
.
wipStatList
=
[[
0
,
0
]]
# signalizing an event that activates the generator
# self.isRequested=SimEvent('isRequested')
self
.
isRequested
=
self
.
env
.
event
()
self
.
isRequested
=
self
.
env
.
event
()
# self.canDispose=SimEvent('canDispose')
self
.
canDispose
=
self
.
env
.
event
()
self
.
canDispose
=
self
.
env
.
event
()
# self.interruptionEnd=SimEvent('interruptionEnd')
self
.
interruptionEnd
=
self
.
env
.
event
()
self
.
interruptionEnd
=
self
.
env
.
event
()
# self.interruptionStart=SimEvent('interruptionStart')
self
.
interruptionStart
=
self
.
env
.
event
()
self
.
interruptionStart
=
self
.
env
.
event
()
self
.
interruptedBy
=
None
self
.
entityRemoved
=
self
.
env
.
event
()
self
.
entityRemoved
=
self
.
env
.
event
()
# =======================================================================
# =======================================================================
...
...
dream/simulation/Machine.py
View file @
5190dff0
...
@@ -150,15 +150,6 @@ class Machine(CoreObject):
...
@@ -150,15 +150,6 @@ class Machine(CoreObject):
# flags used for preemption purposes
# flags used for preemption purposes
self
.
isPreemptive
=
isPreemptive
self
.
isPreemptive
=
isPreemptive
self
.
resetOnPreemption
=
resetOnPreemption
self
.
resetOnPreemption
=
resetOnPreemption
# events used by the broker
self
.
brokerIsSet
=
self
.
env
.
event
()
# this event is generated every time an operator is requested by machine for Load operation type.
# if the machine has not succeeded in getting an entity due to the resource absence
# and waits for the next event to get the entity,
# then it must be signalled that the operator is now available
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
# signal used for preemption
self
.
preemptQueue
=
self
.
env
.
event
()
# flag notifying that there is operator assigned to the actievObject
# flag notifying that there is operator assigned to the actievObject
self
.
assignedOperator
=
True
self
.
assignedOperator
=
True
...
...
dream/simulation/MachineManagedJob.py
View file @
5190dff0
...
@@ -55,6 +55,7 @@ class MachineManagedJob(MachineJobShop):
...
@@ -55,6 +55,7 @@ class MachineManagedJob(MachineJobShop):
self
.
operatorPool
.
operators
=
[]
self
.
operatorPool
.
operators
=
[]
#create a Broker
#create a Broker
self
.
broker
=
Broker
(
self
)
self
.
broker
=
Broker
(
self
)
self
.
broker
.
initialize
()
self
.
env
.
process
(
self
.
broker
.
run
())
self
.
env
.
process
(
self
.
broker
.
run
())
# activate(self.broker,self.broker.run())
# activate(self.broker,self.broker.run())
#create a Router
#create a Router
...
@@ -62,6 +63,7 @@ class MachineManagedJob(MachineJobShop):
...
@@ -62,6 +63,7 @@ class MachineManagedJob(MachineJobShop):
from
Globals
import
G
from
Globals
import
G
if
not
G
.
Router
:
if
not
G
.
Router
:
self
.
router
=
Router
()
self
.
router
=
Router
()
self
.
router
.
initialize
()
self
.
env
.
process
(
self
.
router
.
run
())
self
.
env
.
process
(
self
.
router
.
run
())
# activate(self.router,self.router.run())
# activate(self.router,self.router.run())
G
.
Router
=
self
.
router
G
.
Router
=
self
.
router
...
...
dream/simulation/ObjectInterruption.py
View file @
5190dff0
...
@@ -35,13 +35,13 @@ import simpy
...
@@ -35,13 +35,13 @@ import simpy
class
ObjectInterruption
(
object
):
class
ObjectInterruption
(
object
):
def
__init__
(
self
,
victim
=
None
):
def
__init__
(
self
,
victim
=
None
):
from
Globals
import
G
self
.
env
=
G
.
env
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
def
initialize
(
self
):
def
initialize
(
self
):
from
Globals
import
G
self
.
env
=
G
.
env
self
.
call
=
False
self
.
call
=
False
#===========================================================================
#===========================================================================
...
...
dream/simulation/ObjectResource.py
View file @
5190dff0
...
@@ -33,11 +33,11 @@ import simpy
...
@@ -33,11 +33,11 @@ import simpy
class
ObjectResource
(
object
):
class
ObjectResource
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
from
Globals
import
G
self
.
env
=
G
.
env
self
.
initialized
=
False
self
.
initialized
=
False
def
initialize
(
self
):
def
initialize
(
self
):
from
Globals
import
G
self
.
env
=
G
.
env
self
.
totalWorkingTime
=
0
#holds the total working time
self
.
totalWorkingTime
=
0
#holds the total working time
self
.
totalWaitingTime
=
0
#holds the total waiting time
self
.
totalWaitingTime
=
0
#holds the total waiting time
self
.
timeLastOperationStarted
=
0
#holds the time that the last repair was started
self
.
timeLastOperationStarted
=
0
#holds the time that the last repair was started
...
...
dream/simulation/OperatedPoolBroker.py
View file @
5190dff0
...
@@ -48,9 +48,6 @@ class Broker(ObjectInterruption):
...
@@ -48,9 +48,6 @@ class Broker(ObjectInterruption):
self
.
timeOperationStarted
=
0
self
.
timeOperationStarted
=
0
self
.
timeLastOperationEnded
=
0
self
.
timeLastOperationEnded
=
0
self
.
timeWaitForOperatorStarted
=
0
self
.
timeWaitForOperatorStarted
=
0
# Broker events
self
.
isCalled
=
self
.
env
.
event
()
#SimEvent('brokerIsCalled')
self
.
resourceAvailable
=
self
.
env
.
event
()
#SimEvent('resourceAvailable')
self
.
waitForOperator
=
False
self
.
waitForOperator
=
False
#===========================================================================
#===========================================================================
...
@@ -62,6 +59,10 @@ class Broker(ObjectInterruption):
...
@@ -62,6 +59,10 @@ class Broker(ObjectInterruption):
self
.
timeOperationStarted
=
0
self
.
timeOperationStarted
=
0
self
.
timeWaitForOperatorStarted
=
0
self
.
timeWaitForOperatorStarted
=
0
self
.
waitForOperator
=
False
self
.
waitForOperator
=
False
# Broker events
self
.
isCalled
=
self
.
env
.
event
()
self
.
resourceAvailable
=
self
.
env
.
event
()
# =======================================================================
# =======================================================================
# the run method
# the run method
...
...
dream/simulation/OperatorRouter.py
View file @
5190dff0
...
@@ -49,8 +49,6 @@ class Router(ObjectInterruption):
...
@@ -49,8 +49,6 @@ class Router(ObjectInterruption):
def
__init__
(
self
,
sorting
=
False
):
def
__init__
(
self
,
sorting
=
False
):
ObjectInterruption
.
__init__
(
self
)
ObjectInterruption
.
__init__
(
self
)
self
.
type
=
"Router"
self
.
type
=
"Router"
# signal used to initiate the generator of the Router
self
.
isCalled
=
self
.
env
.
event
()
self
.
isInitialized
=
False
self
.
isInitialized
=
False
self
.
candidateOperators
=
[]
self
.
candidateOperators
=
[]
self
.
multipleCriterionList
=
[]
self
.
multipleCriterionList
=
[]
...
@@ -78,6 +76,8 @@ class Router(ObjectInterruption):
...
@@ -78,6 +76,8 @@ class Router(ObjectInterruption):
#===========================================================================
#===========================================================================
def
initialize
(
self
):
def
initialize
(
self
):
ObjectInterruption
.
initialize
(
self
)
ObjectInterruption
.
initialize
(
self
)
# signal used to initiate the generator of the Router
self
.
isCalled
=
self
.
env
.
event
()
# list that holds all the objects that can receive
# list that holds all the objects that can receive
self
.
pendingObjects
=
[]
self
.
pendingObjects
=
[]
self
.
calledOperator
=
[]
self
.
calledOperator
=
[]
...
...
dream/simulation/Queue.py
View file @
5190dff0
...
@@ -67,8 +67,6 @@ class Queue(CoreObject):
...
@@ -67,8 +67,6 @@ class Queue(CoreObject):
self
.
gatherWipStat
=
gatherWipStat
self
.
gatherWipStat
=
gatherWipStat
# Will be populated by an event generator
# Will be populated by an event generator
self
.
wip_stat_list
=
[]
self
.
wip_stat_list
=
[]
# event used by router
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
@
staticmethod
@
staticmethod
def
getSupportedSchedulingRules
():
def
getSupportedSchedulingRules
():
...
...
dream/simulation/Source.py
View file @
5190dff0
...
@@ -103,13 +103,6 @@ class Source(CoreObject):
...
@@ -103,13 +103,6 @@ class Source(CoreObject):
self
.
item
=
Globals
.
getClassFromName
(
entity
)
#the type of object that the Source will generate
self
.
item
=
Globals
.
getClassFromName
(
entity
)
#the type of object that the Source will generate
self
.
entityGenerator
=
EntityGenerator
(
victim
=
self
)
# the EntityGenerator of the Source
# self.entityCreated=SimEvent('an entity is created')
self
.
entityCreated
=
self
.
env
.
event
()
# event used by router
# self.loadOperatorAvailable=SimEvent('loadOperatorAvailable')
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
self
.
scheduledEntities
=
[]
# list of creations that are scheduled
self
.
scheduledEntities
=
[]
# list of creations that are scheduled
...
@@ -124,7 +117,8 @@ class Source(CoreObject):
...
@@ -124,7 +117,8 @@ class Source(CoreObject):
# self.Res=Resource(capacity=infinity)
# self.Res=Resource(capacity=infinity)
self
.
Res
=
simpy
.
Resource
(
self
.
env
,
capacity
=
float
(
'inf'
))
self
.
Res
=
simpy
.
Resource
(
self
.
env
,
capacity
=
float
(
'inf'
))
self
.
Res
.
users
=
[]
self
.
Res
.
users
=
[]
# self.Res.waitQ=[]
self
.
entityGenerator
=
EntityGenerator
(
victim
=
self
)
# the EntityGenerator of the Source
self
.
numberOfArrivals
=
0
self
.
numberOfArrivals
=
0
# self.entityGenerator.initialize()
# self.entityGenerator.initialize()
# activate(self.entityGenerator,self.entityGenerator.run())
# activate(self.entityGenerator,self.entityGenerator.run())
...
...
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