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
0d1b0971
Commit
0d1b0971
authored
Oct 29, 2013
by
Ioannis Papagiannopoulos
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
id property added to entity and its childs, global property numberOfEntities added
parent
d1ae4684
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
11 deletions
+13
-11
dream/simulation/Entity.py
dream/simulation/Entity.py
+1
-1
dream/simulation/Frame.py
dream/simulation/Frame.py
+2
-2
dream/simulation/Globals.py
dream/simulation/Globals.py
+1
-0
dream/simulation/Job.py
dream/simulation/Job.py
+3
-3
dream/simulation/Part.py
dream/simulation/Part.py
+2
-3
dream/simulation/Source.py
dream/simulation/Source.py
+4
-2
No files found.
dream/simulation/Entity.py
View file @
0d1b0971
...
...
@@ -29,7 +29,7 @@ Class that acts as an abstract. It should have no instances. All the Entities sh
class
Entity
(
object
):
type
=
"Entity"
def
__init__
(
self
,
nam
e
,
priority
=
0
,
dueDate
=
0
,
orderDate
=
0
):
def
__init__
(
self
,
id
=
None
,
name
=
Non
e
,
priority
=
0
,
dueDate
=
0
,
orderDate
=
0
):
self
.
name
=
name
# information on the object holding the entity
# initialized as None and updated every time an entity enters a new object
...
...
dream/simulation/Frame.py
View file @
0d1b0971
...
...
@@ -35,8 +35,8 @@ class Frame(Entity):
type
=
"Frame"
capacity
=
4
#the number of parts that the frame can take
def
__init__
(
self
,
nam
e
):
Entity
.
__init__
(
self
,
name
)
def
__init__
(
self
,
id
=
None
,
name
=
Non
e
):
Entity
.
__init__
(
self
,
id
=
id
,
name
=
name
)
self
.
Res
=
Resource
(
self
.
capacity
)
#dimension data
...
...
dream/simulation/Globals.py
View file @
0d1b0971
...
...
@@ -64,3 +64,4 @@ class G:
outputJSON
=
{}
outputJSONFile
=
None
numberOfEntities
=
0
\ No newline at end of file
dream/simulation/Job.py
View file @
0d1b0971
...
...
@@ -29,12 +29,12 @@ in the system and also in the processing times at each station
from
Globals
import
G
from
Entity
import
Entity
# ============================ The
part
object ==============================
# ============================ The
job
object ==============================
class
Job
(
Entity
):
# inherits from the Entity class
type
=
"Job"
def
__init__
(
self
,
id
,
nam
e
,
route
=
[],
priority
=
0
,
dueDate
=
0
,
orderDate
=
0
):
Entity
.
__init__
(
self
,
name
,
priority
=
priority
,
dueDate
=
dueDate
,
orderDate
=
orderDate
)
def
__init__
(
self
,
id
=
None
,
name
=
Non
e
,
route
=
[],
priority
=
0
,
dueDate
=
0
,
orderDate
=
0
):
Entity
.
__init__
(
self
,
id
=
id
,
name
=
name
,
priority
=
priority
,
dueDate
=
dueDate
,
orderDate
=
orderDate
)
# instance specific attributes
self
.
id
=
id
# id
# information on the routing and the stops of the entity
...
...
dream/simulation/Part.py
View file @
0d1b0971
...
...
@@ -35,7 +35,6 @@ from Entity import Entity
class
Part
(
Entity
):
type
=
"Part"
def
__init__
(
self
,
nam
e
):
Entity
.
__init__
(
self
,
name
)
def
__init__
(
self
,
id
=
None
,
name
=
Non
e
):
Entity
.
__init__
(
self
,
id
=
id
,
name
=
name
)
#print self.name, now()
dream/simulation/Source.py
View file @
0d1b0971
...
...
@@ -30,6 +30,7 @@ from SimPy.Simulation import now, Process, Resource, infinity, hold
from
Part
import
Part
from
RandomNumberGenerator
import
RandomNumberGenerator
from
CoreObject
import
CoreObject
from
Globals
import
G
#============================================================================
# The Source object is a Process
#============================================================================
...
...
@@ -105,7 +106,8 @@ class Source(CoreObject):
while
1
:
entity
=
self
.
createEntity
()
# create the Entity object and assign its name
self
.
numberOfArrivals
+=
1
# we have one new arrival
self
.
numberOfArrivals
+=
1
# we have one new arrival
G
.
numberOfEntities
+=
1
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
=
self
# update the current station of the Entity
...
...
@@ -122,7 +124,7 @@ class Source(CoreObject):
# creates an Entity
#============================================================================
def
createEntity
(
self
):
return
self
.
item
(
self
.
item
.
type
+
str
(
self
.
numberOfArrivals
))
#return the newly created Entity
return
self
.
item
(
id
=
self
.
item
.
type
+
str
(
G
.
numberOfEntities
),
name
=
self
.
item
.
type
+
str
(
self
.
numberOfArrivals
))
#return the newly created Entity
#============================================================================
# calculates the processing time
#============================================================================
...
...
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