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
06ec4e3a
Commit
06ec4e3a
authored
Apr 11, 2014
by
Georgios Dagkakis
Committed by
Ioannis Papagiannopoulos
May 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
corrections in typing. Now topology9 does not crash, but it hangs forever
parent
37c84aaa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+2
-2
dream/simulation/Source.py
dream/simulation/Source.py
+7
-6
No files found.
dream/simulation/CoreObject.py
View file @
06ec4e3a
...
...
@@ -25,7 +25,7 @@ Created on 12 Jul 2012
Class that acts as an abstract. It should have no instances. All the core-objects should inherit from it
'''
from
SimPy.Simulation
import
Process
,
Resource
,
now
,
SimEvent
,
wait
E
vent
from
SimPy.Simulation
import
Process
,
Resource
,
now
,
SimEvent
,
wait
e
vent
# ===========================================================================
# the core object
...
...
@@ -316,7 +316,7 @@ class CoreObject(Process):
# =======================================================================
def
selectReceiver
(
self
,
possibleReceivers
=
[]):
activeObject
=
self
.
getActiveObject
()
candidates
=
possibleReceive
v
rs
candidates
=
possibleReceivers
# dummy variables that help prioritize the objects requesting to give objects to the Machine (activeObject)
maxTimeWaiting
=
0
# dummy variable counting the time a successor is waiting
receiver
=
None
...
...
dream/simulation/Source.py
View file @
06ec4e3a
...
...
@@ -26,7 +26,7 @@ Created on 8 Nov 2012
models the source object that generates the entities
'''
from
SimPy.Simulation
import
now
,
Process
,
Resource
,
infinity
,
hold
,
SimEvent
from
SimPy.Simulation
import
now
,
Process
,
Resource
,
infinity
,
hold
,
SimEvent
,
activate
from
RandomNumberGenerator
import
RandomNumberGenerator
from
CoreObject
import
CoreObject
from
Globals
import
G
...
...
@@ -49,7 +49,8 @@ class EntityGenerator(Process):
# initialize method of the EntityGenerator
#===========================================================================
def
initialize
(
self
):
Process
.
initialize
(
self
)
pass
#Process.initialize(self)
#===========================================================================
# the generator of the EntitiesGenerator
...
...
@@ -59,11 +60,11 @@ class EntityGenerator(Process):
entity
=
self
.
victim
.
createEntity
()
# create the Entity object and assign its name
entity
.
creationTime
=
now
()
# assign the current simulation time as the Entity's creation time
entity
.
startTime
=
now
()
# assign the current simulation time as the Entity's start time
entity
.
currentStation
=
victim
# update the current station of the Entity
entity
.
currentStation
=
self
.
victim
# update the current station of the Entity
G
.
EntityList
.
append
(
entity
)
self
.
victim
.
outputTrace
(
entity
.
name
,
"generated"
)
# output the trace
victim
.
getActiveObjectQueue
().
append
(
entity
)
# append the entity to the resource
victim
.
numberOfArrivals
+=
1
# we have one new arrival
self
.
victim
.
getActiveObjectQueue
().
append
(
entity
)
# append the entity to the resource
self
.
victim
.
numberOfArrivals
+=
1
# we have one new arrival
G
.
numberOfEntities
+=
1
yield
hold
,
self
,
self
.
victim
.
calculateInterarrivalTime
()
# wait until the next arrival
self
.
victim
.
entityCreated
.
signal
(
str
(
entity
.
id
)
+
' created'
)
...
...
@@ -94,7 +95,7 @@ class Source(CoreObject):
self
.
item
=
Globals
.
getClassFromName
(
entity
)
#the type of object that the Source will generate
self
.
g
enerator
=
EntityGenerator
(
victim
=
self
)
# the EntityGenerator of the Source
self
.
entityG
enerator
=
EntityGenerator
(
victim
=
self
)
# the EntityGenerator of the Source
self
.
entityCreated
=
SimEvent
(
'an entity is created'
)
...
...
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