Commit 34210375 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Ioannis Papagiannopoulos

objects updated to read distributions newstyle

parent 7b9ab64a
...@@ -55,31 +55,22 @@ class Assembly(CoreObject): ...@@ -55,31 +55,22 @@ class Assembly(CoreObject):
self.Working=[] self.Working=[]
self.Blockage=[] self.Blockage=[]
# if input is given in a dictionary if not processingTime:
if inputsDict: processingTime = {'Fixed':{'mean': 0 }}
CoreObject.__init__(self, inputsDict=inputsDict) if 'Normal' in processingTime.keys() and\
# else read the separate ones processingTime['Normal'].get('max', None) is None:
else: processingTime['Normal']['max'] = float(processingTime['Normal']['mean']) + 5 * float(processingTime['Normal']['stdev'])
if not processingTime:
processingTime = {'distributionType': 'Fixed',
'mean': 0,
'stdev': 0,
'min': 0,
}
if processingTime['distributionType'] == 'Normal' and\
processingTime.get('max', None) is None:
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev'])
CoreObject.__init__(self, id, name) CoreObject.__init__(self, id, name)
self.rng=RandomNumberGenerator(self, **processingTime) self.rng=RandomNumberGenerator(self, processingTime)
# ============================== variable that is used for the loading of machines ============= # ============================== variable that is used for the loading of machines =============
self.exitAssignedToReceiver = False # by default the objects are not blocked self.exitAssignedToReceiver = False # by default the objects are not blocked
# when the entities have to be loaded to operatedMachines # when the entities have to be loaded to operatedMachines
# then the giverObjects have to be blocked for the time # then the giverObjects have to be blocked for the time
# that the machine is being loaded # that the machine is being loaded
from Globals import G from Globals import G
G.AssemblyList.append(self) G.AssemblyList.append(self)
# ======================================================================= # =======================================================================
# parses inputs if they are given in a dictionary # parses inputs if they are given in a dictionary
......
...@@ -50,18 +50,17 @@ class BatchDecomposition(CoreObject): ...@@ -50,18 +50,17 @@ class BatchDecomposition(CoreObject):
self.type="BatchDecomposition" #String that shows the type of object self.type="BatchDecomposition" #String that shows the type of object
if not processingTime: if not processingTime:
processingTime = { 'distributionType': 'Fixed', processingTime = {'Fixed':{'mean': 0 }}
'mean': 1, } if 'Normal' in processingTime.keys() and\
if processingTime['distributionType'] == 'Normal' and\ processingTime['Normal'].get('max', None) is None:
processingTime.get('max', None) is None: processingTime['Normal']['max'] = float(processingTime['Normal']['mean']) + 5 * float(processingTime['Normal']['stdev'])
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev'])
# holds the capacity of the object # holds the capacity of the object
self.numberOfSubBatches=int(numberOfSubBatches) self.numberOfSubBatches=int(numberOfSubBatches)
# sets the operator resource of the Machine # sets the operator resource of the Machine
self.operator=operator self.operator=operator
# Sets the attributes of the processing (and failure) time(s) # Sets the attributes of the processing (and failure) time(s)
self.rng=RandomNumberGenerator(self, **processingTime) self.rng=RandomNumberGenerator(self, processingTime)
from Globals import G from Globals import G
G.BatchDecompositionList.append(self) G.BatchDecompositionList.append(self)
......
...@@ -49,18 +49,17 @@ class BatchReassembly(CoreObject): ...@@ -49,18 +49,17 @@ class BatchReassembly(CoreObject):
CoreObject.__init__(self,id, name) CoreObject.__init__(self,id, name)
self.type="BatchRassembly" #String that shows the type of object self.type="BatchRassembly" #String that shows the type of object
if not processingTime: if not processingTime:
processingTime = { 'distributionType': 'Fixed', processingTime = {'Fixed':{'mean': 0 }}
'mean': 1, } if 'Normal' in processingTime.keys() and\
if processingTime['distributionType'] == 'Normal' and\ processingTime['Normal'].get('max', None) is None:
processingTime.get('max', None) is None: processingTime['Normal']['max'] = float(processingTime['Normal']['mean']) + 5 * float(processingTime['Normal']['stdev'])
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev'])
# holds the capacity of the object # holds the capacity of the object
self.numberOfSubBatches=numberOfSubBatches self.numberOfSubBatches=numberOfSubBatches
# sets the operator resource of the Machine # sets the operator resource of the Machine
self.operator=operator self.operator=operator
# Sets the attributes of the processing (and failure) time(s) # Sets the attributes of the processing (and failure) time(s)
self.rng=RandomNumberGenerator(self, **processingTime) self.rng=RandomNumberGenerator(self, processingTime)
from Globals import G from Globals import G
G.BatchReassemblyList.append(self) G.BatchReassemblyList.append(self)
# flag to show if the objects outputs results # flag to show if the objects outputs results
......
...@@ -31,10 +31,10 @@ import simpy ...@@ -31,10 +31,10 @@ import simpy
from RandomNumberGenerator import RandomNumberGenerator from RandomNumberGenerator import RandomNumberGenerator
class BatchSource(Source): class BatchSource(Source):
def __init__(self, id, name, interarrivalTime=None, def __init__(self, id, name, interArrivalTime=None,
entity='Dream.Batch', batchNumberOfUnits=1, **kw): entity='Dream.Batch', batchNumberOfUnits=1, **kw):
Source.__init__(self, id=id, name=name, Source.__init__(self, id=id, name=name,
interarrivalTime=interarrivalTime, entity=entity) interArrivalTime=interArrivalTime, entity=entity)
self.numberOfUnits = int(batchNumberOfUnits) self.numberOfUnits = int(batchNumberOfUnits)
from Globals import G from Globals import G
G.BatchSourceList.append(self) G.BatchSourceList.append(self)
......
...@@ -67,16 +67,12 @@ class Dismantle(CoreObject): ...@@ -67,16 +67,12 @@ class Dismantle(CoreObject):
CoreObject.__init__(self, id, name) CoreObject.__init__(self, id, name)
from Globals import G from Globals import G
if not processingTime: if not processingTime:
processingTime = {'distributionType': 'Fixed', processingTime = {'Fixed':{'mean': 0 }}
'mean': 0, if 'Normal' in processingTime.keys() and\
'stdev': 0, processingTime['Normal'].get('max', None) is None:
'min': 0, processingTime['Normal']['max'] = float(processingTime['Normal']['mean']) + 5 * float(processingTime['Normal']['stdev'])
}
if processingTime['distributionType'] == 'Normal' and\
processingTime.get('max', None) is None:
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev'])
self.rng=RandomNumberGenerator(self, **processingTime) self.rng=RandomNumberGenerator(self, processingTime)
#=========================================================================== #===========================================================================
# the initialize method # the initialize method
......
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