Commit 430b6d15 authored by Georgios Dagkakis's avatar Georgios Dagkakis

assembly and dismantle

parent c8dbdb45
...@@ -41,9 +41,25 @@ class Assembly(CoreObject): ...@@ -41,9 +41,25 @@ class Assembly(CoreObject):
#=========================================================================== #===========================================================================
# initialize the object # initialize the object
#=========================================================================== #===========================================================================
def __init__(self, id, name, processingTime=None): def __init__(self, id='', name='', processingTime=None, inputsDict=None):
from Globals import G self.type="Assembly" #String that shows the type of object
self.env=G.env self.next=[] #list with the next objects in the flow
self.previous=[] #list with the previous objects in the flow
self.previousPart=[] #list with the previous objects that send parts
self.previousFrame=[] #list with the previous objects that send frames
self.nextIds=[] #list with the ids of the next objects in the flow
self.previousIds=[] #list with the ids of the previous objects in the flow
#lists to hold statistics of multiple runs
self.Waiting=[]
self.Working=[]
self.Blockage=[]
# if input is given in a dictionary
if inputsDict:
CoreObject.__init__(self, inputsDict=inputsDict)
# else read the separate ones
else:
if not processingTime: if not processingTime:
processingTime = {'distributionType': 'Fixed', processingTime = {'distributionType': 'Fixed',
'mean': 0, 'mean': 0,
...@@ -55,29 +71,39 @@ class Assembly(CoreObject): ...@@ -55,29 +71,39 @@ class Assembly(CoreObject):
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev']) processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev'])
CoreObject.__init__(self, id, name) CoreObject.__init__(self, id, name)
self.type="Assembly" #String that shows the type of object
self.rng=RandomNumberGenerator(self, **processingTime) self.rng=RandomNumberGenerator(self, **processingTime)
self.next=[] #list with the next objects in the flow # ============================== variable that is used for the loading of machines =============
self.previous=[] #list with the previous objects in the flow self.exitAssignedToReceiver = False # by default the objects are not blocked
self.previousPart=[] #list with the previous objects that send parts # when the entities have to be loaded to operatedMachines
self.previousFrame=[] #list with the previous objects that send frames # then the giverObjects have to be blocked for the time
self.nextIds=[] #list with the ids of the next objects in the flow # that the machine is being loaded
self.previousIds=[] #list with the ids of the previous objects in the flow
# XXX previousFrameIds and previousPartIds are not used
self.previousPartIds=[] #list with the ids of the previous objects in the flow that bring parts
self.previousFrameIds=[] #list with the ids of the previous objects in the flow that bring frames
#lists to hold statistics of multiple runs # =======================================================================
self.Waiting=[] # parses inputs if they are given in a dictionary
self.Working=[] # =======================================================================
self.Blockage=[] def parseInputs(self, inputsDict):
CoreObject.parseInputs(self, inputsDict)
processingTime=inputsDict.get('processingTime',{})
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'])
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
G.AssemblyList.append(self)
#=========================================================================== #===========================================================================
# initialize method # initialize method
......
...@@ -23,7 +23,7 @@ Created on 21 May 2013 ...@@ -23,7 +23,7 @@ Created on 21 May 2013
@author: George @author: George
''' '''
''' '''
Models a dicmantle object Models a dismantle object
it gathers frames that have parts loaded, unloads the parts and sends the frame to one destination and the parts to another it gathers frames that have parts loaded, unloads the parts and sends the frame to one destination and the parts to another
''' '''
...@@ -42,18 +42,9 @@ class Dismantle(CoreObject): ...@@ -42,18 +42,9 @@ class Dismantle(CoreObject):
#=========================================================================== #===========================================================================
# initialize the object # initialize the object
#=========================================================================== #===========================================================================
def __init__(self, id, name, distribution='Fixed', mean=1, stdev=0.1, min=0, max=5): def __init__(self, id='', name='', processingTime=None, inputsDict={}):
CoreObject.__init__(self, id, name)
from Globals import G self.type='Dismantle'
self.env=G.env
self.type="Dismantle" #String that shows the type of object
self.distType=distribution #the distribution that the procTime follows
self.rng=RandomNumberGenerator(self, self.distType)
self.rng.mean=mean
self.rng.stdev=stdev
self.rng.min=min
self.rng.max=max
self.previous=[] #list with the previous objects in the flow self.previous=[] #list with the previous objects in the flow
self.previousIds=[] #list with the ids of the previous objects in the flow self.previousIds=[] #list with the ids of the previous objects in the flow
self.nextPart=[] #list with the next objects that receive parts self.nextPart=[] #list with the next objects that receive parts
...@@ -73,12 +64,47 @@ class Dismantle(CoreObject): ...@@ -73,12 +64,47 @@ class Dismantle(CoreObject):
# 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
if inputsDict:
CoreObject.__init__(self, inputsDict=inputsDict)
else:
CoreObject.__init__(self, id, name)
from Globals import G
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'])
self.rng=RandomNumberGenerator(self, **processingTime)
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def parseInputs(self, inputsDict):
CoreObject.parseInputs(self, inputsDict)
processingTime=inputsDict.get('processingTime',{})
from Globals import G
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'])
self.rng=RandomNumberGenerator(self, **processingTime)
G.DismantleList.append(self)
#=========================================================================== #===========================================================================
# the initialize method # the initialize method
#=========================================================================== #===========================================================================
def initialize(self): def initialize(self):
# Process.__init__(self)
CoreObject.initialize(self) CoreObject.initialize(self)
self.waitToDispose=False #flag that shows if the object waits to dispose an entity self.waitToDispose=False #flag that shows if the object waits to dispose an entity
self.waitToDisposePart=False #flag that shows if the object waits to dispose a part self.waitToDisposePart=False #flag that shows if the object waits to dispose a part
......
...@@ -293,34 +293,15 @@ def createObjects(): ...@@ -293,34 +293,15 @@ def createObjects():
elif objClass in ['Dream.Machine', 'Dream.BatchScrapMachine', 'Dream.M3', 'Dream.MachineJobShop', elif objClass in ['Dream.Machine', 'Dream.BatchScrapMachine', 'Dream.M3', 'Dream.MachineJobShop',
'Dream.MachineManagedJob', 'Dream.MouldAssembly', 'Dream.Exit', 'Dream.ExitJobShop', 'Dream.MachineManagedJob', 'Dream.MouldAssembly', 'Dream.Exit', 'Dream.ExitJobShop',
'Dream.Queue', 'Dream.RoutingQueue', 'Dream.QueueJobShop', 'Dream.QueueManagedJob']: 'Dream.Queue', 'Dream.RoutingQueue', 'Dream.QueueJobShop', 'Dream.QueueManagedJob',
'Dream.Assembly', 'Dream.Dismantle']:
objectType=Globals.getClassFromName(objClass) objectType=Globals.getClassFromName(objClass)
coreObject=objectType(inputsDict=element) coreObject=objectType(inputsDict=element)
coreObject.nextIds=getSuccessorList(element['id']) # update the nextIDs list of the machine
elif objClass=='Dream.Assembly':
A=Assembly(**element)
A.nextIds=getSuccessorList(element['id'])
G.AssemblyList.append(A)
G.ObjList.append(A)
elif objClass=='Dream.Dismantle':
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)
D=Dismantle(id, name, distribution=distributionType, mean=mean,stdev=stdev,min=min,max=max)
# get the successorList for the 'Parts' # get the successorList for the 'Parts'
D.nextPartIds=getSuccessorList(id, lambda source, destination, edge_data: edge_data.get('entity') == 'Part') coreObject.nextPartIds=getSuccessorList(element['id'], lambda source, destination, edge_data: edge_data.get('entity') == 'Part')
# get the successorList for the 'Frames' # get the successorList for the 'Frames'
D.nextFrameIds=getSuccessorList(id, lambda source, destination, edge_data: edge_data.get('entity') == 'Frame') coreObject.nextFrameIds=getSuccessorList(element['id'], lambda source, destination, edge_data: edge_data.get('entity') == 'Frame')
D.nextIds=getSuccessorList(id) coreObject.nextIds=getSuccessorList(element['id']) # update the nextIDs list of the machine
G.DismantleList.append(D)
G.ObjList.append(D)
elif objClass=='Dream.Conveyer': elif objClass=='Dream.Conveyer':
id=element.get('id', 'not found') id=element.get('id', 'not found')
......
...@@ -54,7 +54,7 @@ class Machine(CoreObject): ...@@ -54,7 +54,7 @@ class Machine(CoreObject):
operatorPool='None',operationType='None',\ operatorPool='None',operationType='None',\
setupTime=None, loadTime=None, setupTime=None, loadTime=None,
isPreemptive=False, resetOnPreemption=False, isPreemptive=False, resetOnPreemption=False,
canDeliverOnInterruption=False, inputsDict={}): canDeliverOnInterruption=False, inputsDict={}, failures=None):
self.type="Machine" #String that shows the type of object self.type="Machine" #String that shows the type of object
# if input is given in a dictionary # if input is given in a dictionary
if inputsDict: if inputsDict:
......
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