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
27f54900
Commit
27f54900
authored
Nov 09, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments and cleanup
parent
aa515ad8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
12 deletions
+14
-12
dream/simulation/applications/MilkPlant/MilkPack.py
dream/simulation/applications/MilkPlant/MilkPack.py
+2
-2
dream/simulation/applications/MilkPlant/MilkTank.py
dream/simulation/applications/MilkPlant/MilkTank.py
+11
-9
dream/simulation/applications/MilkPlant/MilkTransport.py
dream/simulation/applications/MilkPlant/MilkTransport.py
+1
-1
No files found.
dream/simulation/applications/MilkPlant/MilkPack.py
View file @
27f54900
...
@@ -22,12 +22,12 @@ Created on 09 11 2015
...
@@ -22,12 +22,12 @@ Created on 09 11 2015
@author: George
@author: George
'''
'''
'''
'''
models a pack of milk
'''
'''
from
dream.simulation.Job
import
Job
from
dream.simulation.Job
import
Job
class
MilkPack
(
Job
):
# inherits from the Entity class
class
MilkPack
(
Job
):
type
=
'Job'
type
=
'Job'
family
=
'Job'
family
=
'Job'
...
...
dream/simulation/applications/MilkPlant/MilkTank.py
View file @
27f54900
...
@@ -22,21 +22,20 @@ Created on 09 11 2015
...
@@ -22,21 +22,20 @@ Created on 09 11 2015
@author: George
@author: George
'''
'''
'''
'''
models a tank of packages of milk
'''
'''
from
dream.simulation.QueueJobShop
import
QueueJobShop
from
dream.simulation.QueueJobShop
import
QueueJobShop
class
MilkTank
(
QueueJobShop
):
class
MilkTank
(
QueueJobShop
):
family
=
'Buffer'
family
=
'Buffer'
def
__init__
(
self
,
id
=
None
,
name
=
None
,
capacity
=
1
,
**
kw
):
QueueJobShop
.
__init__
(
self
,
id
,
name
,
capacity
)
def
initialize
(
self
):
def
initialize
(
self
):
# keep the ids of products that have already been gathered
self
.
alreadyGatheredProductIds
=
[]
self
.
alreadyGatheredProductIds
=
[]
QueueJobShop
.
initialize
(
self
)
QueueJobShop
.
initialize
(
self
)
# extend so that the milk cannot proceed until the whole batch is collected
def
haveToDispose
(
self
,
callerObject
=
None
):
def
haveToDispose
(
self
,
callerObject
=
None
):
if
len
(
self
.
getActiveObjectQueue
()):
if
len
(
self
.
getActiveObjectQueue
()):
activeEntity
=
self
.
getActiveObjectQueue
()[
0
]
activeEntity
=
self
.
getActiveObjectQueue
()[
0
]
...
@@ -49,16 +48,19 @@ class MilkTank(QueueJobShop):
...
@@ -49,16 +48,19 @@ class MilkTank(QueueJobShop):
# print self.env.now, 'gathered', self.getTotalLiters(), 'liters with', self.getFat(), 'fat'
# print self.env.now, 'gathered', self.getTotalLiters(), 'liters with', self.getFat(), 'fat'
self
.
alreadyGatheredProductIds
.
append
(
activeEntity
.
productId
)
self
.
alreadyGatheredProductIds
.
append
(
activeEntity
.
productId
)
return
QueueJobShop
.
haveToDispose
(
self
,
callerObject
)
return
QueueJobShop
.
haveToDispose
(
self
,
callerObject
)
# returns the average fat of the milk that is in the tank
def
getFat
(
self
):
def
getFat
(
self
):
return
self
.
getTotalFat
()
/
float
(
self
.
getTotalLiters
())
return
self
.
getTotalFat
()
/
float
(
self
.
getTotalLiters
())
# returns the total liters of milk that is in the tank
def
getTotalLiters
(
self
):
def
getTotalLiters
(
self
):
totalLiters
=
0
totalLiters
=
0
for
pack
in
self
.
getActiveObjectQueue
():
for
pack
in
self
.
getActiveObjectQueue
():
totalLiters
+=
pack
.
liters
totalLiters
+=
pack
.
liters
return
totalLiters
return
totalLiters
# returns the total fat is in the tank
def
getTotalFat
(
self
):
def
getTotalFat
(
self
):
totalFat
=
0
totalFat
=
0
for
pack
in
self
.
getActiveObjectQueue
():
for
pack
in
self
.
getActiveObjectQueue
():
...
...
dream/simulation/applications/MilkPlant/MilkTransport.py
View file @
27f54900
...
@@ -22,7 +22,7 @@ Created on 09 11 2015
...
@@ -22,7 +22,7 @@ Created on 09 11 2015
@author: George
@author: George
'''
'''
'''
'''
models the transport of the milk
'''
'''
from
dream.simulation.MachineJobShop
import
MachineJobShop
from
dream.simulation.MachineJobShop
import
MachineJobShop
...
...
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