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
78428476
Commit
78428476
authored
May 29, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Machine - Router and Broker activated correctly correctly
parent
84c6233e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
dream/simulation/Machine.py
dream/simulation/Machine.py
+8
-9
No files found.
dream/simulation/Machine.py
View file @
78428476
...
@@ -168,6 +168,7 @@ class Machine(CoreObject):
...
@@ -168,6 +168,7 @@ class Machine(CoreObject):
def
initialize
(
self
):
def
initialize
(
self
):
# using the Process __init__ and not the CoreObject __init__
# using the Process __init__ and not the CoreObject __init__
CoreObject
.
initialize
(
self
)
CoreObject
.
initialize
(
self
)
# initialize the internal Queue (type Resource) of the Machine
# initialize the internal Queue (type Resource) of the Machine
#self.Res=Resource(self.capacity)
#self.Res=Resource(self.capacity)
self
.
Res
=
simpy
.
Resource
(
self
.
env
,
capacity
=
1
)
self
.
Res
=
simpy
.
Resource
(
self
.
env
,
capacity
=
1
)
...
@@ -176,11 +177,11 @@ class Machine(CoreObject):
...
@@ -176,11 +177,11 @@ class Machine(CoreObject):
if
(
self
.
operatorPool
!=
"None"
):
if
(
self
.
operatorPool
!=
"None"
):
self
.
operatorPool
.
initialize
()
self
.
operatorPool
.
initialize
()
self
.
broker
.
initialize
()
self
.
broker
.
initialize
()
activate
(
self
.
broker
,
self
.
broker
.
run
())
self
.
env
.
process
(
self
.
broker
.
run
())
# initialise the router only once
# initialise the router only once
if
not
self
.
router
.
isInitialized
:
if
not
self
.
router
.
isInitialized
:
self
.
router
.
initialize
()
self
.
router
.
initialize
()
activate
(
self
.
router
,
self
.
router
.
run
())
self
.
env
.
process
(
self
.
router
.
run
())
for
operator
in
self
.
operatorPool
.
operators
:
for
operator
in
self
.
operatorPool
.
operators
:
operator
.
coreObjectIds
.
append
(
self
.
id
)
operator
.
coreObjectIds
.
append
(
self
.
id
)
operator
.
coreObjects
.
append
(
self
)
operator
.
coreObjects
.
append
(
self
)
...
@@ -215,13 +216,11 @@ class Machine(CoreObject):
...
@@ -215,13 +216,11 @@ class Machine(CoreObject):
# 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
# self.brokerIsSet=SimEvent('brokerIsSet')
self
.
brokerIsSet
=
self
.
env
.
event
()
self
.
brokerIsSet
=
self
.
env
.
event
()
# this event is generated every time an operator is requested by machine for Load operation type.
# 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
# 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,
# and waits for the next event to get the entity,
# then it must be signalled that the operator is now available
# then it must be signalled that the operator is now available
# self.loadOperatorAvailable=SimEvent('loadOperatorAvailable')
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
# =======================================================================
# =======================================================================
...
@@ -251,13 +250,13 @@ class Machine(CoreObject):
...
@@ -251,13 +250,13 @@ class Machine(CoreObject):
# if an operator was rendered available while it was needed by the machine to proceed with getEntity
# if an operator was rendered available while it was needed by the machine to proceed with getEntity
if
self
.
interruptionEnd
.
value
==
self
.
env
.
now
or
self
.
loadOperatorAvailable
.
value
==
self
.
env
.
now
:
if
self
.
interruptionEnd
.
value
==
self
.
env
.
now
or
self
.
loadOperatorAvailable
.
value
==
self
.
env
.
now
:
if
self
.
interruptionEnd
in
receivedEvent
:
if
self
.
interruptionEnd
in
receivedEvent
:
if
self
.
interruptionEnd
.
value
==
self
.
env
.
now
:
self
.
printTrace
(
self
.
id
,
interruptionEnd
=
str
(
self
.
interruptionEnd
.
value
))
self
.
interruptionEnd
=
self
.
env
.
event
()
self
.
interruptionEnd
=
self
.
env
.
event
()
if
self
.
loadOperatorAvailable
in
receivedEvent
:
if
self
.
loadOperatorAvailable
in
receivedEvent
:
if
self
.
loadOperatorAvailable
.
value
==
self
.
env
.
now
:
self
.
printTrace
(
self
.
id
,
loadOperatorAvailable
=
str
(
self
.
loadOperatorAvailable
.
value
))
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
# if self.interruptionEnd.value==self.env.now:
# self.printTrace(self.id, interruptionEnd=str(self.interruptionEnd.value))
# elif self.loadOperatorAvailable.value==self.env.now:
# self.printTrace(self.id,loadOperatorAvailable=str(self.loadOperatorAvailable.value))
# try to signal the Giver, otherwise wait until it is requested
# try to signal the Giver, otherwise wait until it is requested
if
self
.
signalGiver
():
if
self
.
signalGiver
():
break
break
...
...
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