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
728a6154
Commit
728a6154
authored
Mar 20, 2014
by
Georgios Dagkakis
Committed by
Jérome Perrin
Apr 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor cleanup in BatchScrapMachine comments so that it is easier demonstrated
parent
fcd76f34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
dream/simulation/BatchScrapMachine.py
dream/simulation/BatchScrapMachine.py
+20
-6
No files found.
dream/simulation/BatchScrapMachine.py
View file @
728a6154
...
...
@@ -31,13 +31,17 @@ from SimPy.Simulation import activate, passivate, waituntil, now, hold
from
RandomNumberGenerator
import
RandomNumberGenerator
from
Machine
import
Machine
# ================================================================
# the BatchScrapMachine object
# ================================================================
class
BatchScrapMachine
(
Machine
):
#initialize the id, the capacity of the resource and the distribution
# have to find which distribution returns random integers - Discrete distribution
# =======================================================================
# constructor run every time a new instance is created
# calls the Machine constructor, but also reads attributes for
# scraping distribution
# =======================================================================
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
\
processingTime
=
None
,
failureDistribution
=
'No'
,
MTTF
=
0
,
MTTR
=
0
,
availability
=
0
,
repairman
=
'None'
,
\
...
...
@@ -54,13 +58,19 @@ class BatchScrapMachine(Machine):
repairman
=
repairman
)
self
.
scrapDistType
=
scrapDistribution
#the distribution that the failure follows
#
Sets
the attributes of the scrap quantity distribution
#
set
the attributes of the scrap quantity distribution
self
.
scrapRng
=
RandomNumberGenerator
(
self
,
self
.
scrapDistType
)
self
.
scrapRng
.
mean
=
scrMean
self
.
scrapRng
.
stdev
=
scrStdev
self
.
scrapRng
.
min
=
scrMin
self
.
scrapRng
.
max
=
scrMax
# =======================================================================
# removes an Entity from the Object the Entity to be removed is passed
# as argument by getEntity of the receiver
# extends the default behaviour so that
# it can scrap a number of units before disposing the Batch/SubBatch
# =======================================================================
def
removeEntity
(
self
,
entity
=
None
):
activeEntity
=
Machine
.
removeEntity
(
self
,
entity
)
scrapQuantity
=
self
.
scrapRng
.
generateNumber
()
...
...
@@ -69,10 +79,14 @@ class BatchScrapMachine(Machine):
activeEntity
.
numberOfUnits
==
0
return
activeEntity
#calculates the processing time
# =======================================================================
# calculates the processing time
# extends the default behaviour so that
# the per-unit processing time is multiplied with the number of units
# =======================================================================
def
calculateProcessingTime
(
self
):
activeEntity
=
self
.
getActiveObjectQueue
()[
0
]
return
self
.
rng
.
generateNumber
()
*
activeEntity
.
numberOfUnits
# this is if we have a default processing time for all the entities
return
self
.
rng
.
generateNumber
()
*
activeEntity
.
numberOfUnits
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