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

getProc/Setup/LoadTime turned to static. MachineJobShop updated to comply with...

getProc/Setup/LoadTime turned to static. MachineJobShop updated to comply with the use of get/Proc/Setup/LoatTime - processingTime calculation fixed

Conflicts:
	dream/simulation/Machine.py
parent ba668a4e
...@@ -45,8 +45,8 @@ from RandomNumberGenerator import RandomNumberGenerator ...@@ -45,8 +45,8 @@ from RandomNumberGenerator import RandomNumberGenerator
# =========================================================================== # ===========================================================================
class Machine(CoreObject): class Machine(CoreObject):
family='Server' family='Server'
@staticmethod
def getProcessingTime(self,processingTime): def getProcessingTime(processingTime):
'''returns the processingTime dictionary updated''' '''returns the processingTime dictionary updated'''
if not processingTime: if not processingTime:
processingTime = { 'distributionType': 'Fixed', processingTime = { 'distributionType': 'Fixed',
...@@ -56,7 +56,8 @@ class Machine(CoreObject): ...@@ -56,7 +56,8 @@ class Machine(CoreObject):
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev']) processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev'])
return processingTime return processingTime
def getSetupTime(self,setupTime): @staticmethod
def getSetupTime(setupTime):
'''returns the setupTime dictionary updated''' '''returns the setupTime dictionary updated'''
if not setupTime: if not setupTime:
setupTime = { 'distributionType': 'Fixed', setupTime = { 'distributionType': 'Fixed',
...@@ -66,7 +67,8 @@ class Machine(CoreObject): ...@@ -66,7 +67,8 @@ class Machine(CoreObject):
setupTime['max'] = float(setupTime['mean']) + 5 * float(setupTime['stdev']) setupTime['max'] = float(setupTime['mean']) + 5 * float(setupTime['stdev'])
return setupTime return setupTime
def getLoadTime(self,loadTime): @staticmethod
def getLoadTime(loadTime):
'''returns the loadTime dictionary updated''' '''returns the loadTime dictionary updated'''
if not loadTime: if not loadTime:
loadTime = { 'distributionType': 'Fixed', loadTime = { 'distributionType': 'Fixed',
...@@ -89,11 +91,11 @@ class Machine(CoreObject): ...@@ -89,11 +91,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=self.getProcessingTime(processingTime=processingTime)
setupTime=self.getSetupTime(setupTime) setupTime=self.getSetupTime(setupTime=setupTime)
loadTime=self.getLoadTime(loadTime) loadTime=self.getLoadTime(loadTime=loadTime)
# holds the capacity of the machine # holds the capacity of the machine
self.capacity=capacity self.capacity=capacity
......
...@@ -27,10 +27,41 @@ extends the machine object so that it can act as a jobshop station. It reads the ...@@ -27,10 +27,41 @@ extends the machine object so that it can act as a jobshop station. It reads the
import simpy import simpy
from Machine import Machine from Machine import Machine
from RandomNumberGenerator import RandomNumberGenerator
# =========================================================================== # ===========================================================================
# the MachineJobShop object # the MachineJobShop object
# =========================================================================== # ===========================================================================
class MachineJobShop(Machine): class MachineJobShop(Machine):
@staticmethod
def getProcessingTime(processingTime):
'''returns the processingTime dictionary updated'''
if not processingTime:
processingTime = { 'distributionType': 'Fixed',
'mean': 0, }
if processingTime['distributionType'] == 'Normal' and\
processingTime.get('max', None) is None:
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev'])
return processingTime
@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
...@@ -114,15 +145,19 @@ class MachineJobShop(Machine): ...@@ -114,15 +145,19 @@ 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',{})
self.distType=processingTime.get('distributionType','Fixed') processingTime=self.getProcessingTime(processingTime)
self.procTime=float(processingTime.get('mean', 0)) self.rng=RandomNumberGenerator(self, **processingTime)
self.procTime=self.rng.generateNumber()
setupTime=activeEntity.remainingRoute[0].get('setupTime',{}) setupTime=activeEntity.remainingRoute[0].get('setupTime',{})
self.distType=setupTime.get('distributionType','Fixed') setupTime=self.getSetupTime(setupTime)
self.setupTime=float(setupTime.get('mean', 0)) 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
return activeEntity return activeEntity
#=========================================================================== #===========================================================================
# update the next list of the object based on the activeEentity # update the next list of the object based on the activeEentity
#=========================================================================== #===========================================================================
...@@ -154,26 +189,15 @@ class MachineJobShop(Machine): ...@@ -154,26 +189,15 @@ 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',{})
self.distType=processingTime.get('distributionType','Fixed') processingTime=self.getProcessingTime(processingTime)
self.procTime=float(processingTime.get('mean', 0)) self.rng=RandomNumberGenerator(self, **processingTime)
self.procTime=self.rng.generateNumber()
setupTime=activeEntity.route[0].get('setupTime',{}) setupTime=activeEntity.route[0].get('setupTime',{})
self.distType=setupTime.get('distributionType','Fixed') setupTime=self.getSetupTime(setupTime)
self.setupTime=float(setupTime.get('mean', 0)) 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
# =======================================================================
# calculates the setup time
# =======================================================================
def calculateSetupTime(self):
return self.setupTime #this is the setup time for this unique entity
# =======================================================================
# calculates the Load time
# =======================================================================
def calculateLoadTime(self):
return self.loadTime #this is the load time for this unique entity
# ======================================================================= # =======================================================================
# checks if the Queue can accept an entity # checks if the Queue can accept an entity
# it checks also the next station of the Entity # it checks also the next station of the Entity
...@@ -295,8 +319,8 @@ class MachineJobShop(Machine): ...@@ -295,8 +319,8 @@ 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',{})
self.distType=loadTime.get('distributionType','Fixed') loadTime=self.getLoadTime(loadTime)
self.loadTime=float(loadTime.get('mean', 0)) self.loadRng=RandomNumberGenerator(self, **loadTime)
# ======================================================================= # =======================================================================
# removes an entity from the Machine # removes an entity from the Machine
......
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