Commit c7d7da94 authored by Jérome Perrin's avatar Jérome Perrin

instanciate BatchScrapMachine the new way

parent 75543fda
......@@ -40,21 +40,20 @@ class BatchScrapMachine(Machine):
# have to find which distribution returns random integers - Discrete distribution
def __init__(self, id, name, capacity=1, \
processingTime=None,
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,
**kw):
if not processingTime:
print "TODO"
processingTime = {'distribution': 'Fixed',
'mean': 1}
# initialize using the default method of the object
Machine.__init__(self,id=id,name=name,\
capacity=capacity,\
processingTime=dict(distributionType=distribution,
mean=mean,stdev=stdev,min=min,max=max,),
processingTime=processingTime,
failureDistribution=failureDistribution,MTTF=MTTF,MTTR=MTTR,\
availability=availability,
repairman=repairman, **kw)
self.scrapDistType=scrapDistribution #the distribution that the failure follows
# Sets the attributes of the scrap quantity distribution
self.scrapRng=RandomNumberGenerator(self, self.scrapDistType)
......@@ -62,8 +61,7 @@ class BatchScrapMachine(Machine):
self.scrapRng.stdev=scrStdev
self.scrapRng.min=scrMin
self.scrapRng.max=scrMax
def removeEntity(self, entity=None):
activeEntity = Machine.removeEntity(self, entity)
scrapQuantity=self.scrapRng.generateNumber()
......
......@@ -352,11 +352,6 @@ def createObjects():
id=element.get('id', 'not found')
name=element.get('name', 'not found')
processingTime=element.get('processingTime',{})
distributionType=processingTime.get('distributionType', 'not found')
mean=float(processingTime.get('mean') or 0)
stdev=float(processingTime.get('stdev') or 0)
min=float(processingTime.get('min') or 0)
max=float(processingTime.get('max') or mean+5*stdev)
scrapQuantity=element.get('scrapQuantity', {})
scrapDistributionType=scrapQuantity.get('distributionType', 'not found')
scrMean=int(scrapQuantity.get('mean') or 0)
......@@ -373,9 +368,9 @@ def createObjects():
if(id in repairman.coreObjectIds): # (if any) is assigned to repair
r=repairman # the machine with ID equal to id
M=BatchScrapMachine(id, name, 1, distribution=distributionType, failureDistribution=failureDistribution,
M=BatchScrapMachine(id, name, 1, processingTime, failureDistribution=failureDistribution,
MTTF=MTTF, MTTR=MTTR, availability=availability, repairman=r,
mean=mean,stdev=stdev,min=min,max=max, scrMean=scrMean,
scrMean=scrMean,
scrStdev=scrStdev,scrMin=scrMin,scrMax=scrMax)
M.nextIds=getSuccessorList(id) # update the nextIDs list of the machine
G.MachineList.append(M) # add machine to global MachineList
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment