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
3efe3602
Commit
3efe3602
authored
Nov 01, 2013
by
Ioannis Papagiannopoulos
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new object BatchScrapMachine, not tested yet
parent
840d7423
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
dream/simulation/BatchScrapMachine.py
dream/simulation/BatchScrapMachine.py
+76
-0
No files found.
dream/simulation/BatchScrapMachine.py
0 → 100644
View file @
3efe3602
# ===========================================================================
# 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 8 Nov 2012
@author: Ioannis
'''
'''
Models a machine that processes a (Sub)Batch and can scrap a number of units in each one. Also, the processing time
depends on the number of units of the (Sub)Batch
'''
from
SimPy.Simulation
import
Process
,
Resource
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
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
\
distribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0
,
min
=
0
,
max
=
10
,
\
failureDistribution
=
'No'
,
MTTF
=
0
,
MTTR
=
0
,
availability
=
0
,
repairman
=
'None'
,
\
scrapDistribution
=
'Fixed'
,
scrMean
=
1
,
scrStdev
=
0
,
scrMin
=
0
,
scrMax
=
10
):
# initialize using the default method of the object
Machine
.
__init__
(
self
,
id
=
id
,
name
=
name
,
\
capacity
=
capacity
,
\
distribution
=
distribution
,
\
mean
=
mean
,
stdev
=
stdev
,
min
=
min
,
max
=
max
,
\
failureDistribution
=
failureDistribution
,
MTTF
=
MTTF
,
MTTR
=
MTTR
,
\
availability
=
availability
,
repairman
=
repairman
)
self
.
scrapDistType
=
scrapDistribution
#the distribution that the failure follows
# Sets the attributes of the scrap quantity distribution
self
.
scrapRng
=
RandomNumberGenerator
(
self
,
self
.
scrapDistType
)
self
.
scrapRng
.
avg
=
mean
self
.
scrapRng
.
stdev
=
stdev
self
.
scrapRng
.
min
=
min
self
.
scrapRng
.
max
=
max
def
removeEntity
(
self
):
activeEntity
=
Machine
.
removeEntity
(
self
)
scrapQuantity
=
self
.
scrapRng
.
generateNumber
()
activeEntity
.
numberOfUnits
-=
scrapQuantity
if
activeEntity
.
numberOfUnits
<
0
:
activeEntity
.
numberOfUnits
==
0
return
activeEntity
#calculates the processing time
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
\ 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