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
a5eab28d
Commit
a5eab28d
authored
Apr 19, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new attributes added to entity. Entity now has receiver
parent
a69741e2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
dream/simulation/Entity.py
dream/simulation/Entity.py
+24
-0
dream/simulation/Queue.py
dream/simulation/Queue.py
+3
-3
No files found.
dream/simulation/Entity.py
View file @
a5eab28d
...
@@ -25,6 +25,8 @@ Created on 18 Aug 2013
...
@@ -25,6 +25,8 @@ Created on 18 Aug 2013
Class that acts as an abstract. It should have no instances. All the Entities should inherit from it
Class that acts as an abstract. It should have no instances. All the Entities should inherit from it
'''
'''
from
SimPy.Simulation
import
now
# ===========================================================================
# ===========================================================================
# The entity object
# The entity object
# ===========================================================================
# ===========================================================================
...
@@ -66,6 +68,28 @@ class Entity(object):
...
@@ -66,6 +68,28 @@ class Entity(object):
self
.
candidateReceivers
=
[]
# list of candidateReceivers of the entity (those stations that can receive the entity
self
.
candidateReceivers
=
[]
# list of candidateReceivers of the entity (those stations that can receive the entity
self
.
candidateReceiver
=
None
# the station that is finaly chosen to receive the entity
self
.
candidateReceiver
=
None
# the station that is finaly chosen to receive the entity
# variables used to avoid signalling the same object twice before it receives an entity
self
.
receiver
=
None
self
.
timeOfAssignement
=
0
#===========================================================================
# assign the entity to a station
#===========================================================================
def
assignTo
(
self
,
object
=
None
):
self
.
receiver
=
object
self
.
timeOfAssignement
=
now
()
#===========================================================================
# unassign the entity from the object it is currently assigned to
#===========================================================================
def
unassign
(
self
):
self
.
receiver
=
None
self
.
timeOfAssignement
=
0
#===========================================================================
# returns the object the entity is currently assigned to
#===========================================================================
def
isAssignedTo
(
self
):
return
self
.
receiver
# =======================================================================
# =======================================================================
# outputs results to JSON File
# outputs results to JSON File
# =======================================================================
# =======================================================================
...
...
dream/simulation/Queue.py
View file @
a5eab28d
...
@@ -135,7 +135,7 @@ class Queue(CoreObject):
...
@@ -135,7 +135,7 @@ class Queue(CoreObject):
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
#if we have only one possible receiver just check if the Queue holds one or more entities
#if we have only one possible receiver just check if the Queue holds one or more entities
if
(
len
(
activeObject
.
next
)
==
1
or
callerObject
==
None
):
if
(
callerObject
==
None
):
return
len
(
activeObjectQueue
)
>
0
return
len
(
activeObjectQueue
)
>
0
thecaller
=
callerObject
thecaller
=
callerObject
...
...
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