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

getProcessing/load/setupTime simplified - one method instead getOparationTime

parent 97c04005
...@@ -59,11 +59,11 @@ class Machine(CoreObject): ...@@ -59,11 +59,11 @@ class Machine(CoreObject):
CoreObject.__init__(self, id, name) CoreObject.__init__(self, id, name)
from Globals import G from Globals import G
processingTime=self.getProcessingTime(processingTime=processingTime) processingTime=self.getOperationTime(time=processingTime)
setupTime=self.getSetupTime(setupTime=setupTime) setupTime=self.getOperationTime(time=setupTime)
loadTime=self.getLoadTime(loadTime=loadTime) loadTime=self.getOperationTime(time=loadTime)
# holds the capacity of the machine # holds the capacity of the machine
self.capacity=capacity self.capacity=capacity
...@@ -191,38 +191,16 @@ class Machine(CoreObject): ...@@ -191,38 +191,16 @@ class Machine(CoreObject):
self.processOperatorUnavailable=self.env.event() self.processOperatorUnavailable=self.env.event()
@staticmethod @staticmethod
def getProcessingTime(processingTime): def getOperationTime(time):
'''returns the processingTime dictionary updated''' '''returns the dictionary updated'''
if not processingTime: if not time:
processingTime = { 'distributionType': 'Fixed', time = { 'distributionType': 'Fixed',
'mean': 0, } 'mean': 0 }
if processingTime['distributionType'] == 'Normal' and\ if time['distributionType'] == 'Normal' and\
processingTime.get('max', None) is None: time.get('max', None) is None:
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev']) time['max'] = float(time['mean']) + 5 * float(time['stdev'])
return processingTime return time
@staticmethod
def getSetupTime(setupTime):
'''returns the setupTime dictionary updated'''
if not setupTime:
setupTime = { 'distributionType': 'Fixed',
'mean': 0, }
if setupTime['distributionType'] == 'Normal' and\
setupTime.get('max', None) is None:
setupTime['max'] = float(setupTime['mean']) + 5 * float(setupTime['stdev'])
return setupTime
@staticmethod
def getLoadTime(loadTime):
'''returns the loadTime dictionary updated'''
if not loadTime:
loadTime = { 'distributionType': 'Fixed',
'mean': 0, }
if loadTime['distributionType'] == 'Normal' and\
loadTime.get('max', None) is None:
loadTime['max'] = float(loadTime['mean']) + 5 * float(loadTime['stdev'])
return loadTime
#=========================================================================== #===========================================================================
# create an operatorPool if needed # create an operatorPool if needed
#=========================================================================== #===========================================================================
......
...@@ -33,35 +33,15 @@ from RandomNumberGenerator import RandomNumberGenerator ...@@ -33,35 +33,15 @@ from RandomNumberGenerator import RandomNumberGenerator
# =========================================================================== # ===========================================================================
class MachineJobShop(Machine): class MachineJobShop(Machine):
@staticmethod @staticmethod
def getProcessingTime(processingTime): def getOperationTime(time):
'''returns the processingTime dictionary updated''' '''returns the processingTime dictionary updated'''
if not processingTime: if not time:
processingTime = { 'distributionType': 'Fixed', time = { 'distributionType': 'Fixed',
'mean': 0, } 'mean': 0, }
if processingTime['distributionType'] == 'Normal' and\ if time['distributionType'] == 'Normal' and\
processingTime.get('max', None) is None: time.get('max', None) is None:
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev']) time['max'] = float(time['mean']) + 5 * float(time['stdev'])
return processingTime return time
@staticmethod
def getSetupTime(setupTime):
'''returns the setupTime dictionary updated'''
if not setupTime:
setupTime = { 'distributionType': 'Fixed',
'mean': 0, }
if setupTime['distributionType'] == 'Normal' and\
setupTime.get('max', None) is None:
setupTime['max'] = float(setupTime['mean']) + 5 * float(setupTime['stdev'])
return setupTime
@staticmethod
def getLoadTime(loadTime):
'''returns the loadTime dictionary updated'''
if not loadTime:
loadTime = { 'distributionType': 'Fixed',
'mean': 0, }
if loadTime['distributionType'] == 'Normal' and\
loadTime.get('max', None) is None:
loadTime['max'] = float(loadTime['mean']) + 5 * float(loadTime['stdev'])
return loadTime
# ======================================================================= # =======================================================================
# set all the objects in previous and next # set all the objects in previous and next
...@@ -145,12 +125,12 @@ class MachineJobShop(Machine): ...@@ -145,12 +125,12 @@ class MachineJobShop(Machine):
# read the processing/setup/load times from the corresponding remainingRoute entry # read the processing/setup/load times from the corresponding remainingRoute entry
processingTime=activeEntity.remainingRoute[0].get('processingTime',{}) processingTime=activeEntity.remainingRoute[0].get('processingTime',{})
processingTime=self.getProcessingTime(processingTime) processingTime=self.getOperationTime(processingTime)
self.rng=RandomNumberGenerator(self, **processingTime) self.rng=RandomNumberGenerator(self, **processingTime)
self.procTime=self.rng.generateNumber() self.procTime=self.rng.generateNumber()
setupTime=activeEntity.remainingRoute[0].get('setupTime',{}) setupTime=activeEntity.remainingRoute[0].get('setupTime',{})
setupTime=self.getSetupTime(setupTime) setupTime=self.getOperationTime(setupTime)
self.stpRng=RandomNumberGenerator(self, **setupTime) self.stpRng=RandomNumberGenerator(self, **setupTime)
removedStep = activeEntity.remainingRoute.pop(0) #remove data from the remaining route of the entity removedStep = activeEntity.remainingRoute.pop(0) #remove data from the remaining route of the entity
...@@ -189,12 +169,12 @@ class MachineJobShop(Machine): ...@@ -189,12 +169,12 @@ class MachineJobShop(Machine):
# read the processing/setup/load times from the first entry of the full route # read the processing/setup/load times from the first entry of the full route
activeEntity=self.getActiveObjectQueue()[0] activeEntity=self.getActiveObjectQueue()[0]
processingTime=activeEntity.route[0].get('processingTime',{}) processingTime=activeEntity.route[0].get('processingTime',{})
processingTime=self.getProcessingTime(processingTime) processingTime=self.getOperationTime(processingTime)
self.rng=RandomNumberGenerator(self, **processingTime) self.rng=RandomNumberGenerator(self, **processingTime)
self.procTime=self.rng.generateNumber() self.procTime=self.rng.generateNumber()
setupTime=activeEntity.route[0].get('setupTime',{}) setupTime=activeEntity.route[0].get('setupTime',{})
setupTime=self.getSetupTime(setupTime) setupTime=self.getOperationTime(setupTime)
self.stpRng=RandomNumberGenerator(self, **setupTime) self.stpRng=RandomNumberGenerator(self, **setupTime)
return self.procTime #this is the processing time for this unique entity return self.procTime #this is the processing time for this unique entity
...@@ -320,7 +300,7 @@ class MachineJobShop(Machine): ...@@ -320,7 +300,7 @@ class MachineJobShop(Machine):
thecaller.sortEntities() thecaller.sortEntities()
activeEntity=thecaller.Res.users[0] activeEntity=thecaller.Res.users[0]
loadTime=activeEntity.remainingRoute[0].get('loadTime',{}) loadTime=activeEntity.remainingRoute[0].get('loadTime',{})
loadTime=self.getLoadTime(loadTime) loadTime=self.getOperationTime(loadTime)
self.loadRng=RandomNumberGenerator(self, **loadTime) self.loadRng=RandomNumberGenerator(self, **loadTime)
# ======================================================================= # =======================================================================
......
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