Commit cc5d571e authored by Georgios Dagkakis's avatar Georgios Dagkakis

objects to be able to accept additional keywords and cleanup of deprecated code

parent 3cc9ee98
......@@ -41,7 +41,7 @@ class Assembly(CoreObject):
#===========================================================================
# initialize the object
#===========================================================================
def __init__(self, id='', name='', processingTime=None, inputsDict=None):
def __init__(self, id='', name='', processingTime=None, inputsDict=None, **kw):
self.type="Assembly" #String that shows the type of object
self.next=[] #list with the next objects in the flow
self.previous=[] #list with the previous objects in the flow
......
......@@ -34,7 +34,7 @@ from SubBatch import SubBatch
class Batch(Entity):
type="Batch"
def __init__(self, id, name, numberOfUnits=1, remainingProcessingTime=0, unitsToProcess=0):
def __init__(self, id, name, numberOfUnits=1, remainingProcessingTime=0, unitsToProcess=0, **kw):
Entity.__init__(self, name=name, id=id, remainingProcessingTime=remainingProcessingTime)
self.numberOfUnits=int(numberOfUnits)
self.numberOfSubBatches=1 #integer that shows in how many sub batches is the batch broken
......
......@@ -45,7 +45,7 @@ class BatchDecomposition(CoreObject):
# =======================================================================
#initialize the id, the capacity of the object and the distribution
# =======================================================================
def __init__(self, id, name, processingTime=None, numberOfSubBatches=1, operator='None'):
def __init__(self, id, name, processingTime=None, numberOfSubBatches=1, operator='None', **kw):
CoreObject.__init__(self, id, name)
self.type="BatchDecomposition" #String that shows the type of object
......
......@@ -44,7 +44,7 @@ class BatchReassembly(CoreObject):
# =======================================================================
#initialize the id, the capacity of the object and the distribution
# =======================================================================
def __init__(self, id, name, numberOfSubBatches=1, processingTime=None, operator='None'):
def __init__(self, id, name, numberOfSubBatches=1, processingTime=None, operator='None', **kw):
CoreObject.__init__(self,id, name)
self.type="BatchRassembly" #String that shows the type of object
if not processingTime:
......
......@@ -45,7 +45,7 @@ class BatchScrapMachine(Machine):
# =======================================================================
def __init__(self, id, name, capacity=1, \
processingTime=None, repairman='None',\
scrapQuantity={}):
scrapQuantity={}, **kw):
if not processingTime:
processingTime = {'distributionType': 'Fixed',
'mean': 1}
......
......@@ -32,7 +32,7 @@ from RandomNumberGenerator import RandomNumberGenerator
class BatchSource(Source):
def __init__(self, id, name, interarrivalTime=None,
entity='Dream.Batch', batchNumberOfUnits=1):
entity='Dream.Batch', batchNumberOfUnits=1, **kw):
Source.__init__(self, id=id, name=name,
interarrivalTime=interarrivalTime, entity=entity)
self.numberOfUnits = int(batchNumberOfUnits)
......
......@@ -34,7 +34,8 @@ from Entity import Entity
class CapacityEntity(Entity):
type="CapacityEntity"
def __init__(self, id=None, name=None, capacityProjectId=None, requiredCapacity=10, priority=0, dueDate=0, orderDate=0, isCritical=False):
def __init__(self, id=None, name=None, capacityProjectId=None, requiredCapacity=10, priority=0, dueDate=0,
orderDate=0, isCritical=False, **kw):
Entity.__init__(self, id, name, priority, dueDate, orderDate, isCritical)
self.capacityProjectId=capacityProjectId # the project id hat the capacity Entity is part of
self.capacityProject=None # the project that the capacity Entity is part of. It is defined in initialize
......
......@@ -35,7 +35,7 @@ class CapacityProject(Entity):
type="CapacityProject"
def __init__(self, id=None, name=None, capacityRequirementDict={}, earliestStartDict={}, dueDate=0,
assemblySpaceRequirement=0):
assemblySpaceRequirement=0, **kw):
Entity.__init__(self, id, name, dueDate=dueDate)
# a dict that shows the required capacity from every station
self.capacityRequirementDict=capacityRequirementDict
......
......@@ -40,7 +40,7 @@ class CapacityStation(Queue):
# the __init__ method of the CapacityStation
#===========================================================================
def __init__(self, id, name, capacity=float("inf"), intervalCapacity=[], schedulingRule="FIFO", gatherWipStat=False,
sharedResources={}):
sharedResources={}, **kw):
Queue.__init__(self, id, name, capacity=capacity)
# a list that holds the capacity (manhours) that is available in each interval
self.intervalCapacity=intervalCapacity
......
......@@ -35,7 +35,8 @@ class CapacityStationBuffer(Queue):
#===========================================================================
# the __init__ method of the CapacityStationBuffer
#===========================================================================
def __init__(self, id, name, requireFullProject =False, capacity=float("inf"), isDummy=False, schedulingRule="FIFO", gatherWipStat=False):
def __init__(self, id, name, requireFullProject =False, capacity=float("inf"), isDummy=False,
schedulingRule="FIFO", gatherWipStat=False,**kw):
Queue.__init__(self, id, name, capacity=capacity)
self.isLocked=True
self.requireFullProject=requireFullProject # flag that shows if here the whole project is assembled
......
......@@ -33,7 +33,8 @@ from Globals import G
class CapacityStationController(EventGenerator):
def __init__(self, id=id, name=None, start=0, stop=float('inf'), interval=1,
duration=0, method=None, argumentDict=None, dueDateThreshold=float('inf'), prioritizeIfCanFinish=False):
duration=0, method=None, argumentDict=None, dueDateThreshold=float('inf'),
prioritizeIfCanFinish=False,**kw):
EventGenerator.__init__(self, id, name, start, stop, interval,
duration, method, argumentDict)
# attribute used by optimization in calculateWhatIsToBeProcessed
......
......@@ -38,7 +38,7 @@ class CapacityStationExit(Exit):
#===========================================================================
# the __init__ method of the CapacityStationExit
#===========================================================================
def __init__(self, id, name=None, nextCapacityStationBufferId=None):
def __init__(self, id, name=None, nextCapacityStationBufferId=None,**kw):
Exit.__init__(self, id, name)
self.isLocked=True
self.nextCapacityStationBufferId=nextCapacityStationBufferId # the id of the next station. If it is None it
......
......@@ -43,7 +43,7 @@ class ConditionalBuffer(QueueManagedJob):
# whereas the default capacity is set to infinity
# =======================================================================
def __init__(self, id, name, capacity=-1, isDummy=False,
schedulingRule="FIFO"):
schedulingRule="FIFO",**kw):
QueueManagedJob.__init__(self, id=id, name=name, capacity=capacity,
isDummy=isDummy, schedulingRule=schedulingRule)
......
......@@ -40,7 +40,7 @@ class Conveyer(CoreObject):
#===========================================================================
# the conveyer __init__ method
#===========================================================================
def __init__(self, id, name, length, speed):
def __init__(self, id, name, length, speed,**kw):
CoreObject.__init__(self, id, name)
self.type="Conveyer"
self.speed=float(speed) #the speed of the conveyer in m/sec
......
......@@ -42,7 +42,7 @@ class Dismantle(CoreObject):
#===========================================================================
# initialize the object
#===========================================================================
def __init__(self, id='', name='', processingTime=None):
def __init__(self, id='', name='', processingTime=None,**kw):
self.type='Dismantle'
self.previous=[] #list with the previous objects in the flow
......
......@@ -35,7 +35,7 @@ class Entity(object):
type="Entity"
def __init__(self, id=None, name=None, priority=0, dueDate=0, orderDate=0,
isCritical=False, remainingProcessingTime=0):
isCritical=False, remainingProcessingTime=0,**kw):
self.name=name
self.id=id
# information on the object holding the entity
......
......@@ -32,7 +32,7 @@ from ObjectInterruption import ObjectInterruption
class EventGenerator(ObjectInterruption):
def __init__(self, id=id, name=None, start=0, stop=float('inf'), interval=1,
duration=0, method=None, argumentDict=None):
duration=0, method=None, argumentDict=None,**kw):
ObjectInterruption.__init__(self)
self.id=id
self.name=name
......
......@@ -37,7 +37,7 @@ class Exit(CoreObject):
family='Exit'
def __init__(self, id='', name='', inputsDict={}):
def __init__(self, id, name, **kw):
self.type="Exit" # XXX needed ?
#lists to hold statistics of multiple runs
self.Exits=[]
......
......@@ -34,14 +34,6 @@ from Exit import Exit
# the ExitJobShop object
# ===========================================================================
class ExitJobShop(Exit):
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def parseInputs(self, inputsDict):
Exit.parseInputs(self, inputsDict)
from Globals import G
G.ExitJobShopList.append(self)
# =======================================================================
# set all the objects in previous
......
......@@ -35,7 +35,7 @@ from ObjectInterruption import ObjectInterruption
class Failure(ObjectInterruption):
def __init__(self, victim=None, distribution=None, index=0, repairman=None, offshift=False,
deteriorationType='constant'):
deteriorationType='constant',**kw):
#Process.__init__(self)
ObjectInterruption.__init__(self,victim)
if distribution:
......
......@@ -35,7 +35,7 @@ class Frame(Entity):
type="Frame"
capacity=4 #the number of parts that the frame can take
def __init__(self, id=None, name=None):
def __init__(self, id=None, name=None,**kw):
Entity.__init__(self,id=id,name = name)
self.Res=Resource(self.capacity)
......
......@@ -36,7 +36,8 @@ class Job(Entity): # inherits from the Entity c
type='Job'
family='Job'
def __init__(self, id=None, name=None, route=[], priority=0, dueDate=0, orderDate=0, extraPropertyDict=None,isCritical=False):
def __init__(self, id=None, name=None, route=[], priority=0, dueDate=0, orderDate=0,
extraPropertyDict=None,isCritical=False,**kw):
Entity.__init__(self, id=id,name=name, priority=priority, dueDate=dueDate, orderDate=orderDate, isCritical=isCritical)
# instance specific attributes
# information on the routing and the stops of the entity
......
......@@ -258,15 +258,6 @@ def createObjectResourcesAndCoreObjects():
if issubclass(objectType, CoreObject):
# remove data that has to do with wip or object interruption. CoreObjects do not need it
inputDict=dict(element)
if 'wip' in inputDict:
del inputDict['wip']
if 'failures' in inputDict:
del inputDict['failures']
if 'shift' in inputDict:
del inputDict['shift']
if 'scheduledMaintenance' in inputDict:
del inputDict['scheduledMaintenance']
# create the CoreObject
coreObject=objectType(**inputDict)
# update the nextIDs list of the object
......
......@@ -54,7 +54,7 @@ class Machine(CoreObject):
operatorPool='None',operationType='None',\
setupTime=None, loadTime=None,
preemption={},
canDeliverOnInterruption=False):
canDeliverOnInterruption=False, **kw):
self.type="Machine" #String that shows the type of object
CoreObject.__init__(self, id, name)
from Globals import G
......
......@@ -32,14 +32,6 @@ from Machine import Machine
# ===========================================================================
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,14 +39,6 @@ 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
# =======================================================================
......
......@@ -42,7 +42,7 @@ class Mould(Job): # inherits from the Job class
orderDate=None,
extraPropertyDict=None,
order=None,
isCritical=False):
isCritical=False,**kw):
Job.__init__(self, id, name, route, priority, dueDate, orderDate, extraPropertyDict, isCritical)
self.order=order # parent order of the order component
# TODO: in case the order is not given as argument (when the component is given as WIP) have to give a manager as argument
......
......@@ -81,8 +81,7 @@ class MouldAssembly(MachineManagedJob):
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def parseInputs(self, inputsDict):
MachineManagedJob.parseInputs(self, inputsDict)
def parseInputs(self, **kw):
from Globals import G
G.MouldAssemblyList.append(self)
......
......@@ -46,7 +46,7 @@ class MouldAssemblyBuffer(QueueManagedJob):
# whereas the default capacity is set to infinity
# =======================================================================
def __init__(self, id, name, capacity=-1, isDummy=False,
schedulingRule="FIFO"):
schedulingRule="FIFO",**kw):
QueueManagedJob.__init__(self, id=id, name=name, capacity=capacity,
isDummy=isDummy, schedulingRule=schedulingRule)
......
......@@ -34,7 +34,7 @@ import simpy
#===============================================================================
class ObjectInterruption(object):
def __init__(self, victim=None):
def __init__(self, victim=None,**kw):
self.victim=victim
# variable used to hand in control to the objectInterruption
self.call=False
......
......@@ -32,7 +32,7 @@ import simpy
# ===========================================================================
class ObjectResource(object):
def __init__(self):
def __init__(self,**kw):
self.initialized = False
# list that holds the objectInterruptions that have this element as victim
self.objectInterruptions=[]
......
......@@ -37,7 +37,7 @@ from ObjectResource import ObjectResource
class Operator(ObjectResource):
family='Operator'
def __init__(self, id, name, capacity=1, schedulingRule='FIFO', skills=[], available=True):
def __init__(self, id, name, capacity=1, schedulingRule='FIFO', skills=[], available=True,**kw):
ObjectResource.__init__(self)
self.id=id
self.objName=name
......
......@@ -35,7 +35,7 @@ from Operator import Operator
# ===========================================================================
class OperatorManagedJob(Operator):
def __init__(self, id, name, capacity=1,schedulingRule="FIFO"):
def __init__(self, id, name, capacity=1,schedulingRule="FIFO",**kw):
Operator.__init__(self,id=id,name=name,capacity=capacity,schedulingRule=schedulingRule)
from Globals import G
G.OperatorManagedJobsList.append(self)
......
......@@ -37,7 +37,7 @@ from Operator import Operator
# ===========================================================================
class OperatorPool(ObjectResource):
def __init__(self, id, name, capacity=1, operatorsList='None'):
def __init__(self, id, name, capacity=1, operatorsList='None',**kw):
capacity = int(capacity or 1)
......
......@@ -45,7 +45,8 @@ class Order(Job):
manager=None,
basicsEnded=0,
componentsReadyForAssembly=0,
extraPropertyDict=None):
extraPropertyDict=None,
**kw):
Job. __init__(self, id=id, name=name, route=route, priority=priority, dueDate=dueDate, orderDate=orderDate,
extraPropertyDict=extraPropertyDict)
# self.isCritical=isCritical # flag to inform weather the order is critical -> preemption
......
......@@ -44,7 +44,8 @@ class OrderComponent(Job): # inherits from the
order=None,
requestingComponent = None,
readyForAssembly = 0,
isCritical=False):
isCritical=False,
**kw):
Job.__init__(self, id, name, route, priority, dueDate, orderDate, extraPropertyDict, isCritical)
self.auxiliaryList=[] # Holds the auxiliary components that the component needs for a certain processing
self.order=order # parent order of the order component
......
......@@ -43,7 +43,8 @@ class OrderDesign(Job): # inherits from the Job
extraPropertyDict=None,
order=None,
requestingComponent = None,
isCritical=False):
isCritical=False,
**kw):
Job.__init__(self, id, name, route, priority, dueDate, orderDate, extraPropertyDict, isCritical)
self.order=order # parent order of the order component
# TODO: in case the order is not given as argument (when the component is given as WIP) have to give a manager as argument
......
......@@ -33,7 +33,7 @@ from Entity import Entity
#The part object
class Part(Entity):
type="Part"
def __init__(self, id=None, name=None, remainingProcessingTime=0):
def __init__(self, id=None, name=None, remainingProcessingTime=0,**kw):
Entity.__init__(self, id, name, remainingProcessingTime=remainingProcessingTime)
......@@ -37,7 +37,8 @@ class Queue(CoreObject):
#===========================================================================
# the __init__ method of the Queue
#===========================================================================
def __init__(self, id='', name='', capacity=1, isDummy=False, schedulingRule="FIFO", level=None, gatherWipStat=False, inputsDict={}):
def __init__(self, id='', name='', capacity=1, isDummy=False, schedulingRule="FIFO",
level=None, gatherWipStat=False, **kw):
self.type="Queue" # String that shows the type of object
CoreObject.__init__(self, id, name)
capacity=float(capacity)
......
......@@ -33,14 +33,6 @@ from Queue import Queue
# ===========================================================================
class QueueJobShop(Queue):
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def parseInputs(self, inputsDict):
Queue.parseInputs(self, inputsDict)
from Globals import G
G.QueueJobShopList.append(self)
# =======================================================================
# set all the objects in previous and next
# =======================================================================
......
......@@ -41,22 +41,12 @@ class NoCallerError(Exception):
# ===========================================================================
class QueueManagedJob(QueueJobShop):
def __init__(self, id='', name='', capacity=1, isDummy=False, schedulingRule="FIFO", inputsDict={}):
if inputsDict:
QueueJobShop.__init__(self,inputsDict=inputsDict)
else:
def __init__(self, id, name, capacity=1, isDummy=False, schedulingRule="FIFO", **kw):
QueueJobShop.__init__(self, id=id, name=name,capacity=capacity, isDummy=isDummy, schedulingRule=schedulingRule)
# variable used by the sortEntities method
# to identify the object it will be sorting for (manager.checkIfResourceIsAvailable(self.objectSortingFor))
self.objectSortingFor=None
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def parseInputs(self, inputsDict):
QueueJobShop.parseInputs(self, inputsDict)
from Globals import G
G.QueueManagedJobList.append(self)
# =======================================================================
# set all the objects in previous and next
......
......@@ -34,7 +34,7 @@ from Operator import Operator
# the resource that repairs the machines
# ===========================================================================
class Repairman(Operator):
def __init__(self, id, name, capacity=1):
def __init__(self, id, name, capacity=1,**kw):
Operator.__init__(self,id=id, name=name, capacity=capacity)
self.type="Repairman"
from Globals import G
......
......@@ -34,14 +34,6 @@ from Queue import Queue
# ===========================================================================
class RoutingQueue(Queue):
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def parseInputs(self, inputsDict):
Queue.parseInputs(self, inputsDict)
from Globals import G
G.RoutingQueueList.append(self)
# =======================================================================
# checks if the Queue can dispose an entity to the following object
# it checks also who called it and returns TRUE
......
......@@ -38,7 +38,7 @@ class ScheduledMaintenance(ObjectInterruption):
# =======================================================================
# the __init__() method of the class
# =======================================================================
def __init__(self, victim=None, start=0, duration=1, endStatus='interrupted'):
def __init__(self, victim=None, start=0, duration=1, endStatus='interrupted',**kw):
'''
interrupted : the maintenance starts immediately
loaded : the maintenance starts as soon as the victim has ended processing
......
......@@ -39,7 +39,7 @@ class ShiftScheduler(ObjectInterruption):
# =======================================================================
# the __init__() method of the class
# =======================================================================
def __init__(self, victim=None, shiftPattern=[], endUnfinished=False, receiveBeforeEndThreshold=0.0):
def __init__(self, victim=None, shiftPattern=[], endUnfinished=False, receiveBeforeEndThreshold=0.0,**kw):
ObjectInterruption.__init__(self,victim)
self.type='ShiftScheduler'
self.shiftPattern=shiftPattern
......
......@@ -78,7 +78,7 @@ class Source(CoreObject):
#===========================================================================
# the __init__method of the Source class
#===========================================================================
def __init__(self, id, name, interarrivalTime=None, entity='Dream.Part'):
def __init__(self, id, name, interarrivalTime=None, entity='Dream.Part',**kw):
# Default values
if not interarrivalTime:
interarrivalTime = {'distributionType': 'Fixed', 'mean': 1}
......
......@@ -32,7 +32,7 @@ class SubBatch(Entity):
type="SubBatch"
def __init__(self, id, name, numberOfUnits=1, parentBatch=None, parentBatchName=None, parentBatchId=None,
remainingProcessingTime=0, unitsToProcess=0):
remainingProcessingTime=0, unitsToProcess=0,**kw):
Entity.__init__(self, name=name, id=id, remainingProcessingTime=remainingProcessingTime)
self.numberOfUnits=int(numberOfUnits)
self.parentBatch=parentBatch
......
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