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
605285e8
Commit
605285e8
authored
Oct 22, 2013
by
Georgios Dagkakis
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More cleanup in source. Batch and SubBatch Entities created
parent
12a91ca1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
5 deletions
+83
-5
dream/simulation/Batch.py
dream/simulation/Batch.py
+38
-0
dream/simulation/Source.py
dream/simulation/Source.py
+7
-5
dream/simulation/SubBatch.py
dream/simulation/SubBatch.py
+38
-0
No files found.
dream/simulation/Batch.py
0 → 100644
View file @
605285e8
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 22 Oct 2013
@author: George
'''
'''
Batch is an Entity that contains a number of units
'''
from
Entity
import
Entity
#The batch object
class
Batch
(
Entity
):
type
=
"Batch"
def
__init__
(
self
,
id
,
name
,
numberOfUnits
=
1
):
Entity
.
__init__
(
self
,
name
)
self
.
id
=
id
self
.
numberOfUnits
=
numberOfUnits
\ No newline at end of file
dream/simulation/Source.py
View file @
605285e8
...
@@ -84,21 +84,23 @@ class Source(CoreObject):
...
@@ -84,21 +84,23 @@ class Source(CoreObject):
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
i
=
0
while
1
:
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
entity
=
self
.
item
(
self
.
item
.
type
+
"_"
+
self
.
objName
+
"_"
+
str
(
i
))
#create the Entity object and assign its name
entity
.
creationTime
=
now
()
#assign the current simulation time as the Entity's creation time
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
.
startTime
=
now
()
#assign the current simulation time as the Entity's start time
self
.
outputTrace
(
self
.
item
.
type
+
"_"
+
self
.
objName
+
"_"
+
str
(
i
))
#output the trace
self
.
outputTrace
(
self
.
item
.
type
+
str
(
self
.
numberOfArrivals
))
#output the trace
activeObjectQueue
.
append
(
entity
)
#append the entity to the resource
activeObjectQueue
.
append
(
entity
)
#append the entity to the resource
i
+=
1
yield
hold
,
self
,
self
.
calculateInterarrivalTime
()
#wait until the next arrival
yield
hold
,
self
,
self
.
calculateInterarrivalTime
()
#wait until the next arrival
#sets the routing out element for the Source
#sets the routing out element for the Source
def
defineRouting
(
self
,
successorList
=
[]):
def
defineRouting
(
self
,
successorList
=
[]):
self
.
next
=
successorList
self
.
next
=
successorList
#creates an Entity
def
createEntity
(
self
):
return
self
.
item
(
self
.
item
.
type
+
str
(
self
.
numberOfArrivals
))
#return the newly created Entity
#calculates the processing time
#calculates the processing time
def
calculateInterarrivalTime
(
self
):
def
calculateInterarrivalTime
(
self
):
return
self
.
rng
.
generateNumber
()
#this is if we have a default interarrival time for all the entities
return
self
.
rng
.
generateNumber
()
#this is if we have a default interarrival time for all the entities
...
...
dream/simulation/SubBatch.py
0 → 100644
View file @
605285e8
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 22 Oct 2013
@author: George
'''
'''
Batch is an Entity that contains a number of units
'''
from
Entity
import
Entity
#The batch object
class
SubBatch
(
Entity
):
type
=
"SubBatch"
def
__init__
(
self
,
id
,
name
,
batchId
,
numberOfUnits
=
1
):
Entity
.
__init__
(
self
,
name
)
self
.
id
=
id
self
.
numberOfUnits
=
numberOfUnits
self
.
batchId
=
batchId
\ No newline at end of file
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