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
5a8adb90
Commit
5a8adb90
authored
Sep 09, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Nov 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CoreObjects follow the expectedSignals paradeigm
parent
bc5fb8a0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
13 deletions
+24
-13
dream/simulation/Exit.py
dream/simulation/Exit.py
+3
-1
dream/simulation/Queue.py
dream/simulation/Queue.py
+5
-1
dream/simulation/Source.py
dream/simulation/Source.py
+16
-11
No files found.
dream/simulation/Exit.py
View file @
5a8adb90
...
...
@@ -62,7 +62,9 @@ class Exit(CoreObject):
self
.
totalLifespan
=
0
self
.
totalTaktTime
=
0
# the total time between to consecutive exits
self
.
intervalThroughPutList
=
[]
self
.
intervalThroughPutList
=
[]
self
.
expectedSignals
[
'isRequested'
]
=
1
def
run
(
self
):
...
...
dream/simulation/Queue.py
View file @
5a8adb90
...
...
@@ -86,12 +86,16 @@ class Queue(CoreObject):
self
.
Res
=
simpy
.
Resource
(
self
.
env
,
self
.
capacity
)
# event used by router
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
self
.
expectedSignals
[
'isRequested'
]
=
1
self
.
expectedSignals
[
'canDispose'
]
=
1
self
.
expectedSignals
[
'loadOperatorAvailable'
]
=
1
#===========================================================================
# run method of the queue
#===========================================================================
def
run
(
self
):
def
run
(
self
):
activeObjectQueue
=
self
.
Res
.
users
# check if there is WIP and signal receiver
self
.
initialSignalReceiver
()
...
...
dream/simulation/Source.py
View file @
5a8adb90
...
...
@@ -63,8 +63,9 @@ class EntityGenerator(object):
self
.
victim
.
numberOfArrivals
+=
1
# we have one new arrival
G
.
numberOfEntities
+=
1
self
.
victim
.
appendEntity
(
entity
)
succeedTupple
=
(
entity
,
self
.
env
.
now
)
self
.
victim
.
entityCreated
.
succeed
(
succeedTupple
)
if
self
.
victim
.
expectedSignals
[
'entityCreated'
]:
succeedTupple
=
(
entity
,
self
.
env
.
now
)
self
.
victim
.
entityCreated
.
succeed
(
succeedTupple
)
# else put it on the time list for scheduled Entities
else
:
entityCounter
=
G
.
numberOfEntities
+
len
(
self
.
victim
.
scheduledEntities
)
# this is used just ot output the trace correctly
...
...
@@ -125,6 +126,10 @@ class Source(CoreObject):
# self.loadOperatorAvailable=SimEvent('loadOperatorAvailable')
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
self
.
scheduledEntities
=
[]
# list of creations that are scheduled
self
.
expectedSignals
[
'entityCreated'
]
=
1
self
.
expectedSignals
[
'loadOperatorAvailable'
]
=
1
self
.
expectedSignals
[
'canDispose'
]
=
1
#===========================================================================
# the generator of the Source class
...
...
@@ -142,13 +147,12 @@ class Source(CoreObject):
transmitter
,
eventTime
=
self
.
entityCreated
.
value
self
.
entityCreated
=
self
.
env
.
event
()
# otherwise, if the receiver requests availability then try to signal him if there is anything to dispose of
if
self
.
canDispose
in
receivedEvent
or
self
.
loadOperatorAvailable
in
receivedEvent
:
if
self
.
canDispose
in
receivedEvent
:
transmitter
,
eventTime
=
self
.
canDispose
.
value
self
.
canDispose
=
self
.
env
.
event
()
if
self
.
loadOperatorAvailable
in
receivedEvent
:
transmitter
,
eventTime
=
self
.
loadOperatorAvailable
.
value
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
if
self
.
canDispose
in
receivedEvent
:
transmitter
,
eventTime
=
self
.
canDispose
.
value
self
.
canDispose
=
self
.
env
.
event
()
if
self
.
loadOperatorAvailable
in
receivedEvent
:
transmitter
,
eventTime
=
self
.
loadOperatorAvailable
.
value
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
if
self
.
haveToDispose
():
if
self
.
signalReceiver
():
continue
...
...
@@ -198,6 +202,7 @@ class Source(CoreObject):
self
.
appendEntity
(
newEntity
)
activeEntity
=
CoreObject
.
removeEntity
(
self
,
entity
)
# run the default method
if
len
(
self
.
getActiveObjectQueue
())
==
1
:
succeedTuple
=
(
newEntity
,
self
.
env
.
now
)
self
.
entityCreated
.
succeed
(
succeedTuple
)
if
self
.
expectedSignals
[
'entityCreated'
]:
succeedTuple
=
(
newEntity
,
self
.
env
.
now
)
self
.
entityCreated
.
succeed
(
succeedTuple
)
return
activeEntity
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