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
3cacf8ad
Commit
3cacf8ad
authored
May 29, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OrderDecomposition updated
parent
c2eab620
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
dream/simulation/OrderDecomposition.py
dream/simulation/OrderDecomposition.py
+9
-5
No files found.
dream/simulation/OrderDecomposition.py
View file @
3cacf8ad
...
...
@@ -26,8 +26,9 @@ OrderDecomposition is a Core Object that takes an order after design and decompo
dummy object: infinite capacity no processing time
'''
from
SimPy.Simulation
import
Process
,
Resource
from
SimPy.Simulation
import
waituntil
,
now
,
hold
,
infinity
,
waitevent
# from SimPy.Simulation import Process, Resource
# from SimPy.Simulation import waituntil, now, hold, infinity, waitevent
import
simpy
from
Globals
import
G
from
CoreObject
import
CoreObject
...
...
@@ -57,7 +58,7 @@ class OrderDecomposition(CoreObject):
self
.
previous
=
G
.
ObjList
self
.
next
=
[]
CoreObject
.
initialize
(
self
)
# using the default CoreObject Functionality
self
.
Res
=
Resource
(
infinity
)
# initialize the Internal resource (Queue) functionality. This is a dummy object so
self
.
Res
=
simpy
.
Resource
(
self
.
env
,
'inf'
)
# initialize the Internal resource (Queue) functionality. This is a dummy object so
# infinite capacity is assumed
self
.
newlyCreatedComponents
=
[]
# a list to hold components just after decomposition
self
.
orderToBeDecomposed
=
None
...
...
@@ -70,13 +71,16 @@ class OrderDecomposition(CoreObject):
self
.
initialSignalReceiver
()
while
1
:
#wait until the Queue can accept an entity and one predecessor requests it
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
canDispose
]
receivedEvent
=
yield
self
.
isRequested
|
self
.
canDispose
# if the event that activated the thread is isRequested then getEntity
if
self
.
isRequested
.
signalparam
:
if
self
.
isRequested
in
receivedEvent
:
self
.
isRequested
=
self
.
env
.
event
()
# reset the isRequested signal parameter
self
.
isRequested
.
signalparam
=
None
self
.
getEntity
()
self
.
decompose
()
if
self
.
canDispose
in
receivedEvent
:
self
.
canDispose
=
self
.
env
.
event
()
# if the event that activated the thread is canDispose then signalReceiver
if
self
.
haveToDispose
():
# print now(), self.id, 'will try to signal a receiver from generator'
...
...
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