Commit d79a65f6 authored by Jérome Perrin's avatar Jérome Perrin

No core object constructor needs to accept **kw

**kw has the problem that unexpected arguments are accepted
also fix 65ea4ef8 that was not reading min and stdev from first distribution
parent c7d7da94
......@@ -37,13 +37,14 @@ from CoreObject import CoreObject
class Assembly(CoreObject):
#initialize the object
def __init__(self, id, name, processingTime=None, **kw):
def __init__(self, id, name, processingTime=None):
if not processingTime:
processingTime = {'distributionType': 'Fixed',
'mean': 0,
'stdev': 0,
'min': 0,
'max': 0,}
'max': 0,
}
CoreObject.__init__(self, id, name)
self.type="Assembly" #String that shows the type of object
self.rng=RandomNumberGenerator(self, **processingTime)
......
......@@ -45,7 +45,7 @@ class BatchDecomposition(CoreObject):
#initialize the id, the capacity of the object and the distribution
# =======================================================================
def __init__(self, id, name, numberOfSubBatches=1, distribution='Fixed', \
mean=1, stdev=0, min=0, max=10, operator='None', **kw):
mean=1, stdev=0, min=0, max=10, operator='None'):
CoreObject.__init__(self, id, name)
self.type="BatchDecomposition" #String that shows the type of object
# holds the capacity of the object
......
......@@ -46,7 +46,7 @@ class BatchReassembly(CoreObject):
#initialize the id, the capacity of the object and the distribution
# =======================================================================
def __init__(self, id, name, numberOfSubBatches=1, distribution='Fixed', \
mean=1, stdev=0, min=0, max=10, operator='None', **kw):
mean=1, stdev=0, min=0, max=10, operator='None'):
Process.__init__(self)
# hold the id, name, and type of the Machine instance
self.id=id
......
......@@ -41,8 +41,7 @@ class BatchScrapMachine(Machine):
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,
**kw):
scrapDistribution='Fixed',scrMean=1,scrStdev=0,scrMin=0,scrMax=10):
if not processingTime:
processingTime = {'distribution': 'Fixed',
'mean': 1}
......@@ -52,7 +51,7 @@ class BatchScrapMachine(Machine):
processingTime=processingTime,
failureDistribution=failureDistribution,MTTF=MTTF,MTTR=MTTR,\
availability=availability,
repairman=repairman, **kw)
repairman=repairman)
self.scrapDistType=scrapDistribution #the distribution that the failure follows
# Sets the attributes of the scrap quantity distribution
......
......@@ -44,9 +44,9 @@ class ConditionalBuffer(QueueManagedJob):
# whereas the default capacity is set to infinity
# =======================================================================
def __init__(self, id, name, capacity=-1, isDummy=False,
schedulingRule="FIFO", **kw):
schedulingRule="FIFO"):
QueueManagedJob.__init__(self, id=id, name=name, capacity=capacity,
isDummy=isDummy, schedulingRule=schedulingRule, **kw)
isDummy=isDummy, schedulingRule=schedulingRule)
# =======================================================================
# checks if the Buffer can dispose an entity.
......
......@@ -35,7 +35,7 @@ from CoreObject import CoreObject
#The conveyer object
class Conveyer(CoreObject):
def __init__(self, id, name, length, speed, **kw):
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
......
......@@ -41,8 +41,7 @@ class Dismantle(CoreObject):
# =======================================================================
# initialize the object
# =======================================================================
def __init__(self, id, name, distribution='Fixed', mean=1, stdev=0.1,
min=0, max=5, **kw):
def __init__(self, id, name, distribution='Fixed', mean=1, stdev=0.1, min=0, max=5):
CoreObject.__init__(self, id, name)
self.type="Dismantle" #String that shows the type of object
self.distType=distribution #the distribution that the procTime follows
......
......@@ -31,7 +31,7 @@ from ObjectInterruption import ObjectInterruption
class EventGenerator(ObjectInterruption):
def __init__(self, id=id, name=None, start=None, stop=None, interval=None,
duration=None, method=None, argumentDict=None, **kw):
duration=None, method=None, argumentDict=None):
ObjectInterruption.__init__(self)
self.id=id
self.name=name
......
......@@ -34,7 +34,7 @@ from CoreObject import CoreObject
# ===========================================================================
class Exit(CoreObject):
def __init__(self, id, name=None, **kw):
def __init__(self, id, name=None):
if not name:
name = id
CoreObject.__init__(self, id, name)
......
......@@ -357,7 +357,7 @@ def createObjects():
scrMean=int(scrapQuantity.get('mean') or 0)
scrStdev=float(scrapQuantity.get('stdev') or 0)
scrMin=int(scrapQuantity.get('min') or 0)
scrMax=int(scrapQuantity.get('max') or mean+5*stdev)
scrMax=int(scrapQuantity.get('max') or scrMean+5*scrStdev)
failures=element.get('failures', {})
failureDistribution=failures.get('failureDistribution', 'not found')
MTTF=float(failures.get('MTTF') or 0)
......@@ -416,11 +416,6 @@ def createObjects():
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)
failures=element.get('failures', {})
failureDistribution=failures.get('failureDistribution', 'not found')
MTTF=float(failures.get('MTTF') or 0)
......@@ -433,13 +428,13 @@ def createObjects():
setupMean = float(setupTime.get('setupMean') or 0)
setupStdev=float(setupTime.get('setupStdev') or 0)
setupMin=float(setupTime.get('setupMin') or 0)
setupMax=float(setupTime.get('setupMax') or mean+5*stdev)
setupMax=float(setupTime.get('setupMax') or setupMean+5*setupStdev)
loadTime = element.get('loadTime',{})
loadDistribution = loadTime.get('loadDistribution','not found')
loadMean = float(loadTime.get('loadMean') or 0)
loadStdev = float(loadTime.get('loadStdev') or 0)
loadMin=float(loadTime.get('loadMin') or 0)
loadMax=float(loadTime.get('loadMax') or mean+5*stdev)
loadMax=float(loadTime.get('loadMax') or loadMean+5*loadStdev)
preemption=element.get('preemption',{})
isPreemptive=resetOnPreemption=False
if len(preemption)>0:
......@@ -467,9 +462,8 @@ def createObjects():
if(id in repairman.coreObjectIds):
r=repairman
M=MachineJobShop(id, name, 1, distribution=distributionType, failureDistribution=failureDistribution,
M=MachineJobShop(id, name, 1, processingTime=processingTime, failureDistribution=failureDistribution,
MTTF=MTTF, MTTR=MTTR, availability=availability, #repairman=r,
mean=mean,stdev=stdev,min=min,max=max,
operatorPool=machineOperatorPoolList, operationType=operationType,
loadDistribution=loadDistribution, setupDistribution=setupDistribution,
setupMean=setupMean,setupStdev=setupStdev,setupMin=setupMin,setupMax=setupMax,
......@@ -485,12 +479,7 @@ def createObjects():
elif objClass=='Dream.MachineManagedJob':
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)
processingTime=element.get('processingTime', None)
failures=element.get('failures', {})
failureDistribution=failures.get('failureDistribution', 'not found')
MTTF=float(failures.get('MTTF') or 0)
......@@ -503,13 +492,13 @@ def createObjects():
setupMean = float(setupTime.get('setupMean') or 0)
setupStdev=float(setupTime.get('setupStdev') or 0)
setupMin=float(setupTime.get('setupMin') or 0)
setupMax=float(setupTime.get('setupMax') or mean+5*stdev)
setupMax=float(setupTime.get('setupMax') or setupMean+5*setupStdev)
loadTime = element.get('loadTime',{})
loadDistribution = loadTime.get('loadDistribution','not found')
loadMean = float(loadTime.get('loadMean') or 0)
loadStdev = float(loadTime.get('loadStdev') or 0)
loadMin=float(loadTime.get('loadMin') or 0)
loadMax=float(loadTime.get('loadMax') or mean+5*stdev)
loadMax=float(loadTime.get('loadMax') or setupMean+5*setupStdev)
preemption=element.get('preemption',{})
isPreemptive=resetOnPreemption=False
if len(preemption)>0:
......@@ -537,9 +526,8 @@ def createObjects():
if(id in repairman.coreObjectIds):
r=repairman
M=MachineManagedJob(id, name, 1, distribution=distributionType, failureDistribution=failureDistribution,
M=MachineManagedJob(id, name, 1, processingTime=processingTime, failureDistribution=failureDistribution,
MTTF=MTTF, MTTR=MTTR, availability=availability, #repairman=r,
mean=mean,stdev=stdev,min=min,max=max,
operatorPool=machineOperatorPoolList, operationType=operationType,
loadDistribution=loadDistribution, setupDistribution=setupDistribution,
setupMean=setupMean,setupStdev=setupStdev,setupMin=setupMin,setupMax=setupMax,
......@@ -817,12 +805,7 @@ def createObjects():
from MouldAssembly import MouldAssembly
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)
processingTime=element.get('processingTime', None)
failures=element.get('failures', {})
failureDistribution=failures.get('failureDistribution', 'not found')
MTTF=float(failures.get('MTTF') or 0)
......@@ -836,13 +819,13 @@ def createObjects():
setupMean = float(setupTime.get('setupMean') or 0)
setupStdev=float(setupTime.get('setupStdev') or 0)
setupMin=float(setupTime.get('setupMin') or 0)
setupMax=float(setupTime.get('setupMax') or mean+5*stdev)
setupMax=float(setupTime.get('setupMax') or setupMean+5*setupStdev)
loadTime = element.get('loadTime',{})
loadDistribution = loadTime.get('loadDistribution','not found')
loadMean = float(loadTime.get('loadMean') or 0)
loadStdev = float(loadTime.get('loadStdev') or 0)
loadMin=float(loadTime.get('loadMin') or 0)
loadMax=float(loadTime.get('loadMax') or mean+5*stdev)
loadMax=float(loadTime.get('loadMax') or loadMean+5*loadStdev)
resetOnPreemption=bool(int(element.get('resetOnPreemption') or 0))
if len(G.OperatorPoolsList)>0:
......@@ -866,9 +849,8 @@ def createObjects():
if(id in repairman.coreObjectIds):
r=repairman
MA=MouldAssembly(id, name, 1, distribution=distributionType, failureDistribution=failureDistribution,
MA=MouldAssembly(id, name, 1, processingTime=processingTime, failureDistribution=failureDistribution,
MTTF=MTTF, MTTR=MTTR, availability=availability, #repairman=r,
mean=mean,stdev=stdev,min=min,max=max,
operatorPool=machineOperatorPoolList, operationType=operationType,
loadDistribution=loadDistribution, setupDistribution=setupDistribution,
setupMean=setupMean,setupStdev=setupStdev,setupMin=setupMin,setupMax=setupMax,
......
......@@ -51,7 +51,7 @@ class Machine(CoreObject):
operatorPool='None',operationType='None',\
loadDistribution="No",loadMean=0, loadStdev=0, loadMin=0, loadMax=10,
setupDistribution="No",setupMean=0, setupStdev=0, setupMin=0, setupMax=10,
isPreemptive=False, resetOnPreemption=False, **kw):
isPreemptive=False, resetOnPreemption=False):
CoreObject.__init__(self, id, name)
self.type="Machine" #String that shows the type of object
......
......@@ -45,9 +45,9 @@ class MouldAssemblyBuffer(QueueManagedJob):
# whereas the default capacity is set to infinity
# =======================================================================
def __init__(self, id, name, capacity=-1, isDummy=False,
schedulingRule="FIFO", **kw):
schedulingRule="FIFO"):
QueueManagedJob.__init__(self, id=id, name=name, capacity=capacity,
isDummy=isDummy, schedulingRule=schedulingRule, **kw)
isDummy=isDummy, schedulingRule=schedulingRule)
# =======================================================================
# Sort the entities of the activeQ
......
......@@ -34,7 +34,7 @@ from Repairman import Repairman
# ===========================================================================
class Operator(Repairman): # XXX isn't it the other way around ?
def __init__(self, id, name, capacity=1):
def __init__(self, id, name, capacity=1, schedulingRule="FIFO"):
Repairman.__init__(self, id=id, name=name, capacity=capacity)
self.type="Operator"
self.activeCallersList=[] # the list of object that request the operator
......
......@@ -37,7 +37,7 @@ from Operator import Operator
# ===========================================================================
class OperatorPool(ObjectResource):
def __init__(self, id, name, capacity=1, operatorsList='None', **kw):
def __init__(self, id, name, capacity=1, operatorsList='None'):
capacity = int(capacity or 1)
......
......@@ -34,7 +34,7 @@ from CoreObject import CoreObject
# ===========================================================================
class Queue(CoreObject):
def __init__(self, id, name, capacity=1, isDummy=False, schedulingRule="FIFO", **kw):
def __init__(self, id, name, capacity=1, isDummy=False, schedulingRule="FIFO"):
CoreObject.__init__(self, id, name)
# Process.__init__(self)
# used for the routing of the entities
......
......@@ -36,7 +36,7 @@ from ObjectResource import ObjectResource
# ===========================================================================
class Repairman(ObjectResource):
def __init__(self, id, name, capacity=1, **kw):
def __init__(self, id, name, capacity=1):
ObjectResource.__init__(self)
self.id=id
self.objName=name
......
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