Commit f969ec9a authored by Georgios Dagkakis's avatar Georgios Dagkakis

more changes

parent 8f437377
......@@ -57,11 +57,13 @@ class BatchDecomposition(CoreObject):
processingTime['max'] = float(processingTime['mean']) + 5 * float(processingTime['stdev'])
# holds the capacity of the object
self.numberOfSubBatches=numberOfSubBatches
self.numberOfSubBatches=int(numberOfSubBatches)
# sets the operator resource of the Machine
self.operator=operator
# Sets the attributes of the processing (and failure) time(s)
self.rng=RandomNumberGenerator(self, **processingTime)
from Globals import G
G.BatchDecompositionList.append(self)
# =======================================================================
# initialize the internal resource of the object
......
......@@ -60,6 +60,8 @@ class BatchReassembly(CoreObject):
self.operator=operator
# Sets the attributes of the processing (and failure) time(s)
self.rng=RandomNumberGenerator(self, **processingTime)
from Globals import G
G.BatchReassemblyList.append(self)
# =======================================================================
# initialize the internal resource of the object
......
......@@ -43,16 +43,9 @@ class BatchScrapMachine(Machine):
# calls the Machine constructor, but also reads attributes for
# scraping distribution
# =======================================================================
def __init__(self, id='', name='', capacity=1, \
processingTime=None,
failureDistribution='No', MTTF=0, MTTR=0, availability=0, repairman='None',\
scrapDistribution='Fixed',scrMean=1,scrStdev=0,scrMin=0,scrMax=10,
inputsDict={}):
# if input is given in a dictionary
if inputsDict:
Machine.__init__(self,inputsDict=inputsDict)
# else read the separate ones
else:
def __init__(self, id, name, capacity=1, \
processingTime=None, repairman='None',\
scrapQuantity={}):
if not processingTime:
processingTime = {'distribution': 'Fixed',
'mean': 1}
......@@ -60,31 +53,10 @@ class BatchScrapMachine(Machine):
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
scrapQuantity=inputsDict.get('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)
self.scrapRng=RandomNumberGenerator(self, **scrapQuantity)
from Globals import G
G.BatchScrapMachineList.append(self)
......
......@@ -35,7 +35,9 @@ class BatchSource(Source):
entity='Dream.Batch', batchNumberOfUnits=1):
Source.__init__(self, id=id, name=name,
interarrivalTime=interarrivalTime, entity=entity)
self.numberOfUnits = batchNumberOfUnits
self.numberOfUnits = int(batchNumberOfUnits)
from Globals import G
G.BatchSourceList.append(self)
def createEntity(self):
......
......@@ -43,8 +43,8 @@ class Conveyer(CoreObject):
def __init__(self, id, name, length, speed):
CoreObject.__init__(self, id, name)
self.type="Conveyer"
self.speed=speed #the speed of the conveyer in m/sec
self.length=length #the length of the conveyer in meters
self.speed=float(speed) #the speed of the conveyer in m/sec
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
self.numberOfMoves=0
......@@ -55,6 +55,8 @@ class Conveyer(CoreObject):
# when the entities have to be loaded to operatedMachines
# then the giverObjects have to be blocked for the time
# that the machine is being loaded
from Globals import G
G.ConveyerList.append(self)
#===========================================================================
# the initialize method
......
......@@ -42,7 +42,7 @@ class Dismantle(CoreObject):
#===========================================================================
# initialize the object
#===========================================================================
def __init__(self, id='', name='', processingTime=None, inputsDict={}):
def __init__(self, id='', name='', processingTime=None):
self.type='Dismantle'
self.previous=[] #list with the previous objects in the flow
......@@ -64,9 +64,6 @@ class Dismantle(CoreObject):
# when the entities have to be loaded to operatedMachines
# then the giverObjects have to be blocked for the time
# 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:
......@@ -81,26 +78,6 @@ class Dismantle(CoreObject):
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
#===========================================================================
......
......@@ -80,12 +80,6 @@
"distributionType": "Fixed",
"mean": 1.0
},
"successorFrameList": [
"M2"
],
"successorPartList": [
"M3"
],
"top": 0.40931372549019607
},
"E1": {
......
......@@ -85,9 +85,6 @@
"isDummy": "0",
"left": 0.4414893617021277,
"name": "Q1",
"predecessorList": [
"M1"
],
"top": 0.40909090909090906
},
"S1": {
......
......@@ -278,17 +278,12 @@ def createObjects():
element.pop(k, None)
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.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)
if 'wip' in inputDict:
del inputDict['wip']
......@@ -304,57 +299,6 @@ def createObjects():
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
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':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
......
......@@ -57,6 +57,7 @@ class Machine(CoreObject):
canDeliverOnInterruption=False, inputsDict={}, failures=None):
self.type="Machine" #String that shows the type of object
CoreObject.__init__(self, id, name)
from Globals import G
if not processingTime:
processingTime = { 'distributionType': 'Fixed',
'mean': 1, }
......@@ -85,9 +86,29 @@ class Machine(CoreObject):
# Sets the attributes of the processing (and failure) time(s)
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
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()
# create an operatorPool if needed
self.createOperatorPool(operatorPool)
self.createOperatorPool(self.operatorPool)
# holds the Operator currently processing the Machine
self.currentOperator=None
# define if load/setup/removal/processing are performed by the operator
......@@ -118,7 +139,6 @@ class Machine(CoreObject):
self.assignedOperator=True
# flag notifying the the station can deliver entities that ended their processing while interrupted
self.canDeliverOnInterruption=canDeliverOnInterruption
from Globals import G
self.repairman='None'
for repairman in G.RepairmanList: # check which repairman in the G.RepairmanList
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