Commit f969ec9a authored by Georgios Dagkakis's avatar Georgios Dagkakis

more changes

parent 8f437377
...@@ -57,11 +57,13 @@ class BatchDecomposition(CoreObject): ...@@ -57,11 +57,13 @@ class BatchDecomposition(CoreObject):
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['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=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
G.BatchDecompositionList.append(self)
# ======================================================================= # =======================================================================
# initialize the internal resource of the object # initialize the internal resource of the object
...@@ -99,7 +101,7 @@ class BatchDecomposition(CoreObject): ...@@ -99,7 +101,7 @@ class BatchDecomposition(CoreObject):
self.isProcessingInitialWIP=True self.isProcessingInitialWIP=True
break break
# otherwise proceed with getEntity # otherwise proceed with getEntity
else: else:
requestingObject=self.isRequested.value requestingObject=self.isRequested.value
assert requestingObject==self.giver, 'the giver is not the requestingObject' assert requestingObject==self.giver, 'the giver is not the requestingObject'
self.isRequested=self.env.event() self.isRequested=self.env.event()
......
...@@ -60,6 +60,8 @@ class BatchReassembly(CoreObject): ...@@ -60,6 +60,8 @@ class BatchReassembly(CoreObject):
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
G.BatchReassemblyList.append(self)
# ======================================================================= # =======================================================================
# initialize the internal resource of the object # initialize the internal resource of the object
......
...@@ -43,48 +43,20 @@ class BatchScrapMachine(Machine): ...@@ -43,48 +43,20 @@ class BatchScrapMachine(Machine):
# calls the Machine constructor, but also reads attributes for # calls the Machine constructor, but also reads attributes for
# scraping distribution # scraping distribution
# ======================================================================= # =======================================================================
def __init__(self, id='', name='', capacity=1, \ def __init__(self, id, name, capacity=1, \
processingTime=None, processingTime=None, repairman='None',\
failureDistribution='No', MTTF=0, MTTR=0, availability=0, repairman='None',\ scrapQuantity={}):
scrapDistribution='Fixed',scrMean=1,scrStdev=0,scrMin=0,scrMax=10, if not processingTime:
inputsDict={}): processingTime = {'distribution': 'Fixed',
# if input is given in a dictionary 'mean': 1}
if inputsDict: # initialize using the default method of the object
Machine.__init__(self,inputsDict=inputsDict) Machine.__init__(self,id=id,name=name,\
# else read the separate ones capacity=capacity,\
else: processingTime=processingTime,
if not processingTime: repairman=repairman)
processingTime = {'distribution': 'Fixed',
'mean': 1}
# initialize using the default method of the object
Machine.__init__(self,id=id,name=name,\
capacity=capacity,\
processingTime=processingTime,
failureDistribution=failureDistribution,MTTF=MTTF,MTTR=MTTR,\
availability=availability,
repairman=repairman)
self.scrapDistType=scrapDistribution #the distribution that the failure follows
# set the attributes of the scrap quantity distribution
self.scrapRng=RandomNumberGenerator(self, self.scrapDistType)
self.scrapRng.mean=scrMean
self.scrapRng.stdev=scrStdev
self.scrapRng.min=scrMin
self.scrapRng.max=scrMax
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def parseInputs(self, inputsDict):
Machine.parseInputs(self, inputsDict)
# set the attributes of the scrap quantity distribution # set the attributes of the scrap quantity distribution
scrapQuantity=inputsDict.get('scrapQuantity', {}) self.scrapRng=RandomNumberGenerator(self, **scrapQuantity)
self.scrapDistType=scrapQuantity.get('distributionType', 'Fixed')
self.scrapRng=RandomNumberGenerator(self, self.scrapDistType)
self.scrapRng.mean=float(scrapQuantity.get('mean') or 0)
self.scrapRng.stdev=float(scrapQuantity.get('stdev') or 0)
self.scrapRng.min=float(scrapQuantity.get('min') or 0)
self.scrapRng.max=float(scrapQuantity.get('max') or self.scrapRng.mean+5*self.scrapRng.stdev)
from Globals import G from Globals import G
G.BatchScrapMachineList.append(self) G.BatchScrapMachineList.append(self)
......
...@@ -35,7 +35,9 @@ class BatchSource(Source): ...@@ -35,7 +35,9 @@ class BatchSource(Source):
entity='Dream.Batch', batchNumberOfUnits=1): entity='Dream.Batch', batchNumberOfUnits=1):
Source.__init__(self, id=id, name=name, Source.__init__(self, id=id, name=name,
interarrivalTime=interarrivalTime, entity=entity) interarrivalTime=interarrivalTime, entity=entity)
self.numberOfUnits = batchNumberOfUnits self.numberOfUnits = int(batchNumberOfUnits)
from Globals import G
G.BatchSourceList.append(self)
def createEntity(self): def createEntity(self):
......
...@@ -43,8 +43,8 @@ class Conveyer(CoreObject): ...@@ -43,8 +43,8 @@ class Conveyer(CoreObject):
def __init__(self, id, name, length, speed): def __init__(self, id, name, length, speed):
CoreObject.__init__(self, id, name) CoreObject.__init__(self, id, name)
self.type="Conveyer" self.type="Conveyer"
self.speed=speed #the speed of the conveyer in m/sec self.speed=float(speed) #the speed of the conveyer in m/sec
self.length=length #the length of the conveyer in meters self.length=float(length) #the length of the conveyer in meters
# counting the total number of units to be moved through the whole simulation time # counting the total number of units to be moved through the whole simulation time
self.numberOfMoves=0 self.numberOfMoves=0
...@@ -55,6 +55,8 @@ class Conveyer(CoreObject): ...@@ -55,6 +55,8 @@ class Conveyer(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
from Globals import G
G.ConveyerList.append(self)
#=========================================================================== #===========================================================================
# the initialize method # the initialize method
......
...@@ -42,7 +42,7 @@ class Dismantle(CoreObject): ...@@ -42,7 +42,7 @@ class Dismantle(CoreObject):
#=========================================================================== #===========================================================================
# initialize the object # initialize the object
#=========================================================================== #===========================================================================
def __init__(self, id='', name='', processingTime=None, inputsDict={}): def __init__(self, id='', name='', processingTime=None):
self.type='Dismantle' self.type='Dismantle'
self.previous=[] #list with the previous objects in the flow self.previous=[] #list with the previous objects in the flow
...@@ -64,29 +64,7 @@ class Dismantle(CoreObject): ...@@ -64,29 +64,7 @@ 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, id, name)
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 from Globals import G
if not processingTime: if not processingTime:
processingTime = {'distributionType': 'Fixed', processingTime = {'distributionType': 'Fixed',
...@@ -97,10 +75,9 @@ class Dismantle(CoreObject): ...@@ -97,10 +75,9 @@ class Dismantle(CoreObject):
if processingTime['distributionType'] == 'Normal' and\ if processingTime['distributionType'] == 'Normal' and\
processingTime.get('max', None) is None: processingTime.get('max', None) is None:
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev']) processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev'])
self.rng=RandomNumberGenerator(self, **processingTime)
G.DismantleList.append(self)
self.rng=RandomNumberGenerator(self, **processingTime)
#=========================================================================== #===========================================================================
# the initialize method # the initialize method
#=========================================================================== #===========================================================================
......
...@@ -80,12 +80,6 @@ ...@@ -80,12 +80,6 @@
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": 1.0 "mean": 1.0
}, },
"successorFrameList": [
"M2"
],
"successorPartList": [
"M3"
],
"top": 0.40931372549019607 "top": 0.40931372549019607
}, },
"E1": { "E1": {
......
...@@ -85,9 +85,6 @@ ...@@ -85,9 +85,6 @@
"isDummy": "0", "isDummy": "0",
"left": 0.4414893617021277, "left": 0.4414893617021277,
"name": "Q1", "name": "Q1",
"predecessorList": [
"M1"
],
"top": 0.40909090909090906 "top": 0.40909090909090906
}, },
"S1": { "S1": {
......
...@@ -277,18 +277,13 @@ def createObjects(): ...@@ -277,18 +277,13 @@ def createObjects():
for k in ('element_id', 'top', 'left'): for k in ('element_id', 'top', 'left'):
element.pop(k, None) element.pop(k, None)
objClass = element.pop('_class') objClass = element.pop('_class')
if objClass=='Dream.BatchSource':
S = BatchSource(**element)
S.nextIds=getSuccessorList(element['id'])
G.BatchSourceList.append(S)
G.SourceList.append(S)
G.ObjList.append(S)
elif objClass in ['Dream.Machine', 'Dream.BatchScrapMachine', 'Dream.M3', 'Dream.MachineJobShop', if 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', 'Dream.Source']: 'Dream.Assembly', 'Dream.Dismantle', 'Dream.Source', 'Dream.Conveyer',
'Dream.BatchDecomposition', 'Dream.BatchReassembly', 'Dream.LineClearance',
'Dream.BatchSource']:
inputDict=dict(element) inputDict=dict(element)
if 'wip' in inputDict: if 'wip' in inputDict:
del inputDict['wip'] del inputDict['wip']
...@@ -303,58 +298,7 @@ def createObjects(): ...@@ -303,58 +298,7 @@ def createObjects():
# get the successorList for the 'Frames' # get the successorList for the 'Frames'
coreObject.nextFrameIds=getSuccessorList(element['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')
coreObject.nextIds=getSuccessorList(element['id']) # update the nextIDs list of the object coreObject.nextIds=getSuccessorList(element['id']) # update the nextIDs list of the object
elif objClass=='Dream.Conveyer':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
length=float(element.get('length') or mean+5*stdev)
speed=float(element.get('speed') or 1)
C=Conveyer(id, name, length, speed)
C.nextIds=getSuccessorList(id)
G.ObjList.append(C)
G.ConveyerList.append(C)
elif objClass=='Dream.BatchDecomposition':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
processingTime=element.get('processingTime', {})
numberOfSubBatches=int(element.get('numberOfSubBatches') or 0)
BD=BatchDecomposition(id, name, processingTime=processingTime, numberOfSubBatches=numberOfSubBatches)
BD.nextIds=getSuccessorList(id)
G.BatchDecompositionList.append(BD)
G.ObjList.append(BD)
elif objClass=='Dream.BatchDecompositionStartTime':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
processingTime=element.get('processingTime', {})
numberOfSubBatches=int(element.get('numberOfSubBatches') or 0)
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')
processingTime=element.get('processingTime', {})
numberOfSubBatches=int(element.get('numberOfSubBatches') or 0)
BR=BatchReassembly(id, name, processingTime=processingTime, numberOfSubBatches=numberOfSubBatches)
BR.nextIds=getSuccessorList(id)
G.BatchReassemblyList.append(BR)
G.ObjList.append(BR)
elif objClass=='Dream.LineClearance':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
capacity=int(element.get('capacity') or 1)
isDummy=bool(int(element.get('isDummy') or 0))
schedulingRule=element.get('schedulingRule', 'FIFO')
LC=LineClearance(id, name, capacity, isDummy, schedulingRule=schedulingRule)
LC.nextIds=getSuccessorList(id)
G.LineClearanceList.append(LC)
G.ObjList.append(LC)
elif objClass=='Dream.OrderDecomposition': elif objClass=='Dream.OrderDecomposition':
id=element.get('id', 'not found') id=element.get('id', 'not found')
name=element.get('name', 'not found') name=element.get('name', 'not found')
......
...@@ -57,6 +57,7 @@ class Machine(CoreObject): ...@@ -57,6 +57,7 @@ class Machine(CoreObject):
canDeliverOnInterruption=False, inputsDict={}, failures=None): 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
CoreObject.__init__(self, id, name) CoreObject.__init__(self, id, name)
from Globals import G
if not processingTime: if not processingTime:
processingTime = { 'distributionType': 'Fixed', processingTime = { 'distributionType': 'Fixed',
'mean': 1, } 'mean': 1, }
...@@ -85,9 +86,29 @@ class Machine(CoreObject): ...@@ -85,9 +86,29 @@ class Machine(CoreObject):
# 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)
# check whether the operators are provided with a skills set # check whether the operators are provided with a skills set
# check whether the operators are provided with a skills set
self.dedicatedOperator=self.checkForDedicatedOperators()
if len(G.OperatorPoolsList)>0:
for operatorPool in G.OperatorPoolsList: # find the operatorPool assigned to the machine
if(self.id in operatorPool.coreObjectIds): # and add it to the machine's operatorPool
machineOperatorPoolList=operatorPool # there must only one operator pool assigned to the machine,
# otherwise only one of them will be taken into account
else:
machineOperatorPoolList=[] # if there is no operatorPool assigned to the machine
else: # then machineOperatorPoolList/operatorPool is a list
machineOperatorPoolList=[] # if there are no operatorsPool created then the
# then machineOperatorPoolList/operatorPool is a list
if (type(machineOperatorPoolList) is list): # if the machineOperatorPoolList is a list
# find the operators assigned to it and add them to the list
for operator in G.OperatorsList: # check which operator in the G.OperatorsList
if(self.id in operator.coreObjectIds): # (if any) is assigned to operate
machineOperatorPoolList.append(operator) # the machine with ID equal to id
self.operatorPool=machineOperatorPoolList
self.dedicatedOperator=self.checkForDedicatedOperators() self.dedicatedOperator=self.checkForDedicatedOperators()
# create an operatorPool if needed # create an operatorPool if needed
self.createOperatorPool(operatorPool) self.createOperatorPool(self.operatorPool)
# holds the Operator currently processing the Machine # holds the Operator currently processing the Machine
self.currentOperator=None self.currentOperator=None
# define if load/setup/removal/processing are performed by the operator # define if load/setup/removal/processing are performed by the operator
...@@ -118,7 +139,6 @@ class Machine(CoreObject): ...@@ -118,7 +139,6 @@ class Machine(CoreObject):
self.assignedOperator=True self.assignedOperator=True
# flag notifying the the station can deliver entities that ended their processing while interrupted # flag notifying the the station can deliver entities that ended their processing while interrupted
self.canDeliverOnInterruption=canDeliverOnInterruption self.canDeliverOnInterruption=canDeliverOnInterruption
from Globals import G
self.repairman='None' self.repairman='None'
for repairman in G.RepairmanList: # check which repairman in the G.RepairmanList for repairman in G.RepairmanList: # check which repairman in the G.RepairmanList
if(self.id in repairman.coreObjectIds): # (if any) is assigned to repair if(self.id in repairman.coreObjectIds): # (if any) is assigned to repair
......
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