Commit f9504d56 authored by Georgios Dagkakis's avatar Georgios Dagkakis

MachineManagedJob and MachineJobShop updated

parent 97a2b87d
......@@ -291,145 +291,12 @@ def createObjects():
G.SourceList.append(S)
G.ObjList.append(S)
elif objClass in ['Dream.Machine', 'Dream.BatchScrapMachine']:
elif objClass in ['Dream.Machine', 'Dream.BatchScrapMachine', 'Dream.M3', 'Dream.MachineJobShop',
'Dream.MachineManagedJob']:
objectType=Globals.getClassFromName(objClass)
coreObject=objectType(inputsDict=element)
coreObject.nextIds=getSuccessorList(element['id']) # update the nextIDs list of the machine
elif objClass=='Dream.M3':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
processingTime=element.get('processingTime', {})
scrapQuantity=element.get('scrapQuantity', {})
scrapDistributionType=scrapQuantity.get('distributionType', 'not found')
scrMean=float(scrapQuantity.get('mean') or 0)
scrStdev=float(scrapQuantity.get('stdev') or 0)
scrMin=float(scrapQuantity.get('min') or 0)
scrMax=float(scrapQuantity.get('max') or scrMean+5*scrStdev)
failures=element.get('failures', {})
failureDistribution=failures.get('distributionType', 'not found')
MTTF=float(failures.get('MTTF') or 0)
MTTR=float(failures.get('MTTR') or 0)
availability=float(failures.get('availability') or 0)
r='None'
for repairman in G.RepairmanList: # check which repairman in the G.RepairmanList
if(id in repairman.coreObjectIds): # (if any) is assigned to repair
r=repairman # the machine with ID equal to id
M=M3(id, name, 1, processingTime, failureDistribution=failureDistribution,
MTTF=MTTF, MTTR=MTTR, availability=availability, repairman=r,
scrMean=scrMean,
scrStdev=scrStdev,scrMin=scrMin,scrMax=scrMax)
M.nextIds=getSuccessorList(id) # update the nextIDs list of the machine
G.MachineList.append(M) # add machine to global MachineList
G.BatchScrapMachineList.append(M)
G.ObjList.append(M) # add machine to ObjList
elif objClass=='Dream.MachineJobShop':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
failures=element.get('failures', {})
failureDistribution=failures.get('distributionType', 'not found')
MTTF=float(failures.get('MTTF') or 0)
MTTR=float(failures.get('MTTR') or 0)
availability=float(failures.get('availability') or 0)
# type of operation and related times
operationType=element.get('operationType','not found')
setupTime = element.get('setupTime', None)
loadTime = element.get('loadTime', None)
preemption=element.get('preemption',{})
isPreemptive=resetOnPreemption=False
if len(preemption)>0:
isPreemptive=bool(int(preemption.get('isPreemptive') or 0))
resetOnPreemption=bool(int(preemption.get('resetOnPreemption') or 0))
if len(G.OperatorPoolsList)>0:
for operatorPool in G.OperatorPoolsList: # find the operatorPool assigned to the machine
if(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(id in operator.coreObjectIds): # (if any) is assigned to operate
machineOperatorPoolList.append(operator) # the machine with ID equal to id
# if there is no operator assigned then the list will be empty
r='None'
for repairman in G.RepairmanList:
if(id in repairman.coreObjectIds):
r=repairman
M=MachineJobShop(id, name, 1, failureDistribution=failureDistribution,
MTTF=MTTF, MTTR=MTTR, availability=availability, #repairman=r,
operatorPool=machineOperatorPoolList, operationType=operationType,
setupTime=setupTime,
loadTime=loadTime,
repairman=r, isPreemptive=isPreemptive, resetOnPreemption=resetOnPreemption)
M.nextIds=getSuccessorList(id)
G.MachineJobShopList.append(M)
G.MachineList.append(M)
if M.operatorPool!="None":
G.OperatedMachineList.append(M) # add the machine to the operatedMachines List
G.ObjList.append(M)
elif objClass=='Dream.MachineManagedJob':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
failures=element.get('failures', {})
failureDistribution=failures.get('distributionType', 'not found')
MTTF=float(failures.get('MTTF') or 0)
MTTR=float(failures.get('MTTR') or 0)
availability=float(failures.get('availability') or 0)
# type of operation and related times
operationType=element.get('operationType','not found')
setupTime = element.get('setupTime', None)
loadTime = element.get('loadTime', None)
preemption=element.get('preemption',{})
isPreemptive=resetOnPreemption=False
if len(preemption)>0:
isPreemptive=bool(int(preemption.get('isPreemptive') or 0))
resetOnPreemption=bool(int(preemption.get('resetOnPreemption') or 0))
if len(G.OperatorPoolsList)>0:
for operatorPool in G.OperatorPoolsList: # find the operatorPool assigned to the machine
if(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(id in operator.coreObjectIds): # (if any) is assigned to operate
machineOperatorPoolList.append(operator) # the machine with ID equal to id
# if there is no operator assigned then the list will be empty
r='None'
for repairman in G.RepairmanList:
if(id in repairman.coreObjectIds):
r=repairman
M=MachineManagedJob(id, name, 1, failureDistribution=failureDistribution,
MTTF=MTTF, MTTR=MTTR, availability=availability, #repairman=r,
operatorPool=machineOperatorPoolList, operationType=operationType,
setupTime=setupTime,
loadTime=loadTime,
repairman=r, isPreemptive=isPreemptive, resetOnPreemption=resetOnPreemption)
M.nextIds=getSuccessorList(id)
G.MachineManagedJobList.append(M)
G.MachineJobShopList.append(M)
G.MachineList.append(M)
if M.operatorPool!="None":
G.OperatedMachineList.append(M) # add the machine to the operatedMachines List
G.ObjList.append(M)
elif objClass=='Dream.Exit':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
......
......@@ -31,6 +31,15 @@ from Machine import Machine
# the MachineJobShop object
# ===========================================================================
class MachineJobShop(Machine):
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def parseInputs(self, inputsDict):
Machine.parseInputs(self, inputsDict)
from Globals import G
G.MachineJobShopList.append(self)
# =======================================================================
# set all the objects in previous and next
# =======================================================================
......
......@@ -39,6 +39,14 @@ from MachineJobShop import MachineJobShop
# ===========================================================================
class MachineManagedJob(MachineJobShop):
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def parseInputs(self, inputsDict):
MachineJobShop.parseInputs(self, inputsDict)
from Globals import G
G.MachineManagedJobList.append(self)
# =======================================================================
# initialise the MachineManagedJob
# =======================================================================
......
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