Commit c34ed730 authored by Georgios Dagkakis's avatar Georgios Dagkakis

BatchDecomposition/Reassembly set to read distribution in the new style

parent f11bf8f5
......@@ -44,22 +44,23 @@ class BatchDecomposition(CoreObject):
# =======================================================================
#initialize the id, the capacity of the object and the distribution
# =======================================================================
def __init__(self, id, name, numberOfSubBatches=1, distribution='Fixed', \
mean=1, stdev=0, min=0, max=10, operator='None'):
def __init__(self, id, name, processingTime=None, numberOfSubBatches=1, operator='None'):
CoreObject.__init__(self, id, name)
self.type="BatchDecomposition" #String that shows the type of object
if not processingTime:
processingTime = { 'distributionType': 'Fixed',
'mean': 1, }
if processingTime['distributionType'] == 'Normal' and\
processingTime.get('max', None) is None:
processingTime['max'] = processingTime['mean'] + 5 * processingTime['stdev']
# holds the capacity of the object
self.numberOfSubBatches=numberOfSubBatches
# define the distribution types of the processing and failure times respectively
self.distType=distribution #the distribution that the procTime follows
# sets the operator resource of the Machine
self.operator=operator
# Sets the attributes of the processing (and failure) time(s)
self.rng=RandomNumberGenerator(self, self.distType)
self.rng.mean=mean
self.rng.stdev=stdev
self.rng.min=min
self.rng.max=max
self.rng=RandomNumberGenerator(self, **processingTime)
# =======================================================================
# initialize the internal resource of the object
......
......@@ -44,25 +44,25 @@ class BatchReassembly(CoreObject):
# =======================================================================
#initialize the id, the capacity of the object and the distribution
# =======================================================================
def __init__(self, id, name, numberOfSubBatches=1, distribution='Fixed', \
mean=1, stdev=0, min=0, max=10, operator='None'):
def __init__(self, id, name, numberOfSubBatches=1, processingTime=None, operator='None'):
Process.__init__(self)
# hold the id, name, and type of the Machine instance
self.id=id
self.objName=name
self.type="BatchRassembly" #String that shows the type of object
if not processingTime:
processingTime = { 'distributionType': 'Fixed',
'mean': 1, }
if processingTime['distributionType'] == 'Normal' and\
processingTime.get('max', None) is None:
processingTime['max'] = processingTime['mean'] + 5 * processingTime['stdev']
# holds the capacity of the object
self.numberOfSubBatches=numberOfSubBatches
# define the distribution types of the processing and failure times respectively
self.distType=distribution #the distribution that the procTime follows
# sets the operator resource of the Machine
self.operator=operator
# Sets the attributes of the processing (and failure) time(s)
self.rng=RandomNumberGenerator(self, self.distType)
self.rng.mean=mean
self.rng.stdev=stdev
self.rng.min=min
self.rng.max=max
self.rng=RandomNumberGenerator(self, **processingTime)
# for routing purposes
self.next=[] #list with the next objects in the flow
self.previous=[] #list with the previous objects in the flow
......
......@@ -620,8 +620,7 @@ def createObjects():
min=float(processingTime.get('min') or 0)
max=float(processingTime.get('max') or mean+5*stdev)
numberOfSubBatches=int(element.get('numberOfSubBatches') or 0)
BD=BatchDecomposition(id, name, distribution=distributionType, numberOfSubBatches=numberOfSubBatches,
mean=mean,stdev=stdev,min=min,max=max)
BD=BatchDecomposition(id, name, processingTime=processingTime, numberOfSubBatches=numberOfSubBatches)
BD.nextIds=getSuccessorList(id)
G.BatchDecompositionList.append(BD)
G.ObjList.append(BD)
......@@ -636,13 +635,11 @@ def createObjects():
min=float(processingTime.get('min') or 0)
max=float(processingTime.get('max') or mean+5*stdev)
numberOfSubBatches=int(element.get('numberOfSubBatches') or 0)
BD=BatchDecompositionStartTime(id, name, distribution=distributionType, numberOfSubBatches=numberOfSubBatches,
mean=mean,stdev=stdev,min=min,max=max)
BD=BatchDecompositionStartTime(id, name, processingTime=processingTime, numberOfSubBatches=numberOfSubBatches)
BD.nextIds=getSuccessorList(id)
G.BatchDecompositionList.append(BD)
G.ObjList.append(BD)
elif objClass=='Dream.BatchReassembly':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
......@@ -653,8 +650,7 @@ def createObjects():
min=float(processingTime.get('min') or 0)
max=float(processingTime.get('max') or 0)
numberOfSubBatches=int(element.get('numberOfSubBatches') or 0)
BR=BatchReassembly(id, name, distribution=distributionType, numberOfSubBatches=numberOfSubBatches,
mean=mean,stdev=stdev,min=min,max=max)
BR=BatchReassembly(id, name, processingTime=processingTime, numberOfSubBatches=numberOfSubBatches)
BR.nextIds=getSuccessorList(id)
G.BatchReassemblyList.append(BR)
G.ObjList.append(BR)
......
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